Android minSdkVersion、targetSdkVersion、Compile with/即project.propertities中target值 分析

本文详细解析了Android开发中的minSdkVersion、targetSdkVersion及maxSdkVersion等关键概念,帮助开发者更好地理解这些配置项的功能及其对应用兼容性和运行的影响。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Android minSdkVersion:APP的最低运行平台版本(Platform4.0 API Level-11)

 targetSdkVersion:你测试APP的手机版本;直接启用了手机平台API的特性,不用以兼容性运行。(Platform5.1.1 API Level-22)

 Compile with/即project.propertities中target值:Eclipse已经下载了的最新SDK API版本(Platform6.0 API Level-23)

(待验证...)

下面是新建工程时,Eclipse对三者的提示信息:



原文地址:Android <uses-sdk> 和 target 分析  时间:2014-06-03 11:34


Android中<uses-sdk>属性和target属性分析

   1. 概要 

<uses-sdk> 用来描述该应用程序可以运行的最小和最大API级别,以及应用程序开发者设计期望运行的平台版本。通过在manifest清单文件中添加该属性,我们可以更好的控制应用在不同android 系统版本上的安装和兼容性体验问题。

                                                                                  

       (图 1)

    如上图所示,<uses-sdk>通过minSdkVersion,targetSdkVersion,maxSdkVersion三个属性对应用安装兼容性方面进行控制。下面我们依次对这三个属性进行详细介绍。


  2. minSdkVersion

该属性的作用主要体现在两个阶段,一个是在应用安装时,一个是在项目构建时。


     2.1. 安装时作用

               当安装应用的手机系统API level 小于 minSdkVersion的值时,将不能安装该应用。 

       minSdkVersion 用于指明应用程序运行所需的最小API level。如果不指明该属性,其默认值为1。如上图1中minSdkVersion =“8”,说明该应用在只能安装在大于等于android系统API level 为8(android2.2)的系统上。如果将该应用安装在API level 小于8的android系统上,系统会提示手机API level的版本太低,安装失败。 

所以这里有一点需要引起我们注意,我们在开发时必须留意我们用到API 接口的版本。在定义minSdkVersion属性时,尽量要让minSdkVersion的值大于等于我们用到的API 接口的开始被支持的最低版本。这样可以让不支持该接口的android系统不能安装我们的应用,防止应用在一些手机上因兼容性问题而崩溃。


      2.2.构建项目时作用

       在程序中如果我们用到了高于minSdkVersion的值的API接口,Eclipse会自动报错提醒开发者。这里我们以getActionBar()这个接口为例,这个接口是在android 3.0(API leve 11)中出现的。我们通过设置minSdkVersion的值来查看程序中开发工具(Eclipse)对程序的检测。

  • 如下图minSdkVersion = 8时,我们调用API level 为13的接口时Eclipse会自动报错提示开发者:







这里我们可以通过Eclipse 的修复提示选择Add@SuppressLIne “NewApi” 来对付编译错误,但是并不建议这样解决问题。这样虽然躲过了编译报错,能成功编译出apk文件,但是如果在低于android 3.0(API leve 13)系统的手机上安装该应用后运行可能就会出现程序崩溃现象(高于android 3.0(API leve 11)系统的手机上安装运行正常)。对于一个app来说与其在手机上出现崩溃,不如不让用户安装这个应用(个人观点),当然这里需要综合考虑新api的调用频率和场景进行综合判段。

这里采用Eclipse 的@SuppressLint(“NewApi”)方法防止报错提示。

                                 


在android 2.3(API level 9)系统上安装后运行时,应用出现崩溃现象。


  • 这时我们可以考虑能用修改minSdkVersion的值来解决该问题,我们将minSdkVersion的值设置为11。







 一切正常没有报错。这时在android系统版本小于android 3.0(API level 11) 时安装该应用时将不能安装;在android系统3.0以上正常安装运行。



2.3. 总结

从上面两点中我们已经看到了minSdkVersion的重要性。minSdkVersion不仅在程序安装时起作用,也会在项目构建时起作用。我们应该充分利用它的这两个作用,谨慎的设置其值,保证应用不会因为接口兼容问题在一些手机上运行时崩溃影响用户体验


3. maxSdkVersion

      标明可以运行你的应用的最高API Level版本现在Google官方文档中已经建议不推荐使用这个属性了。

在android 1.5,1.6,2.0和2. 0. 1系统上安装应用或系统升级时,系统会检查这个值。在这两种情况下,如果应用设置的maxSdkVersion 值低于系统本身使用的API Level,系统将不会允许安装该应用;在系统升级后,新系统会重新校验这个值,如果新系统的API Level高于这个值,新系统会删除你的应用。在android 2. 0. 1(API level 6)系统后该属性作用已经失效,也建议不在使用该属性。

例如:



在android 2.3(API level  9)上安装该应用时,从下图可以看出maxSdkVersion 已经没有效果了,当系统API level大于maxSdkVersion也照样能安装该应用。



新版本系统基本上是完全兼容以前的老版本的,没有必要设置这个属性去阻止你的应用在新版本上安装;另外,如果你指定了这个属性,用户手机系统升级可能会删掉你的应用。所以这个属性完全没有必要设置的了,这可能也是Google推荐不再使用的原因吧。


4. targetSdkVersion


这个属性会告诉系统该应用已经在API level 为targetSdkVersion值的系统上进行了充分测试,如果系统的API level 和当前应用的targetSdkVersion一样,系统将不会启用兼容模式运行该应用,如果不设置其默认值将等于minSdkVersion的值。

如果平台的API Level高于你的应用程序中的targetSdkVersion属性指定的值,系统会开启兼容行为来确保你的应用程序继续你期望的形式来运行。例如,设置这个targetSdkVersion值为11或更高,当你的应用运行在Android3.0或更高的系统上时,系统会自动为你的应用使用新的默认主题(Holo主题),并且当运行在大屏幕的设备上时会禁用屏幕兼容模式(screen compatibility mode),因为支持了 API level11就暗示了支持大屏幕。一般情况下,应该将这个属性的值设置为最新的API level 值,这样的话就可以充分利用新版本系统上的新特性。Eclipse在生成项目时,默认将该值设置为最高。

Android版本更新时添加新特性详见:

http://developer.android.com/reference/android/os/Build.VERSION_CODES.html

如果平台的API Level低于你的应用程序中的targetSdkVersion属性指定的值时, 系统会开启兼容行为来确保你的应用程序能正常运行,这时一些在targetSdkVersion上的特性就没有了。但是,这个设置仅仅是一个声明、一个通知,在低版本系统中运行不会有太实质的作用。比如:使用了targetSdkVersion这个SDK版本中的一个特性,但是这个特性在低版本中是不支持的,那么在低版本的API设备上运行程序时,可能会报错:java.lang.VerifyError。也就是说,此属性不会帮你解决兼容性的测试问题。你至少需要在minSdkVersion这个版本上将程序完整的跑一遍来确定兼容性是没有问题的

从上面的论述可知,targetSdkVersion这个属性是在程序运行时期起作用的,系统根据这个属性决定要不要以兼容模式运行这个程序。


5. target

Android工程中还有个target属性,这个属性位于Android工程根目录下project.properties中,从名字来看很容易将其功能和targetSdkVersion混淆。

                                        

               

其实他们的功能大相径庭:

  •   targetSdkVersion这个上面已经做过分析,在程序运行时起作用,系统根据这个属性决定要不要以兼容模式运行这个程序。
  •  project.properties中的target是指在编译的时候使用哪个版本的API进行编译。它和工程下导入的api包的API Level保持一致的。如果你更改target的值,上面的api包会跟着变化,你更改api包时target的值也会变化。

6. 参考

项目的build.gradle.kts文件如下: buildscript { repositories { google() mavenCentral() maven { url = uri("https://maven.aliyun.com/repository/public") } maven { url = uri("https://dl.bintray.com/openinstall/maven")} } dependencies { classpath("com.android.tools.build:gradle:8.10.1") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22") } } repositories { google() } APP的build.gradle.kts文件如下: plugins { id("com.android.application") id("org.jetbrains.kotlin.android") } android { namespace = "com.example.gyppcx" // Kotlin DSL 使用等号赋 compileSdk = 36 // 属性名是 compileSdk,不是 compileSdkVersion defaultConfig { applicationId = "com.example.gyppcx" // 使用等号赋 minSdk = 26 // 属性名是 minSdk,不是 minSdkVersion //noinspection OldTargetApi,EditedTargetSdkVersion targetSdk = 34 // 属性名是 targetSdk,不是 targetSdkVersion versionCode = 1 versionName = "1.0" } signingConfigs { create("release") { storeFile = file("../gyppcx.jks") storePassword = "Liu=123456" keyAlias = "key0" keyPassword = "Liu=123456" } } buildTypes { release { signingConfig = signingConfigs.getByName("release") isMinifyEnabled = false proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) } } compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { jvmTarget = "17" } buildFeatures { compose = true } composeOptions { kotlinCompilerExtensionVersion = "1.5.10" } } // 添加依赖项(如果有) repositories { google() mavenCentral() maven { url = uri("https://maven.aliyun.com/repository/public") } maven { url = uri("https://dl.bintray.com/openinstall/maven")} } dependencies { implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) implementation("androidx.appcompat:appcompat:1.7.0") // 确保版本号与项目兼容 implementation("androidx.core:core-ktx:1.13.1") implementation("androidx.webkit:webkit:1.10.0") implementation("com.google.android.material:material:1.11.0") testImplementation("org.junit.jupiter:junit-jupiter:5.10.1") implementation("androidx.compose.ui:ui:1.7.0") implementation("androidx.compose.material3:material3:1.3.0") implementation("androidx.compose.ui:ui-tooling-preview:1.7.0") debugImplementation("androidx.compose.ui:ui-tooling:1.7.0") implementation("androidx.activity:activity-compose:1.8.2") } dependencies { //implementation(files("libs/OpenInstall_v2.8.5.jar")) // 添加这行 implementation("com.openinstall:openinstall-sdk:latest_version") implementation("androidx.appcompat:appcompat:1.7.0") // 确保版本号与项目兼容 implementation("androidx.core:core-ktx:1.13.1") implementation("androidx.webkit:webkit:1.10.0") implementation("com.google.android.material:material:1.11.0") testImplementation("org.junit.jupiter:junit-jupiter:5.10.1") implementation("androidx.compose.ui:ui:1.7.0") implementation("androidx.compose.material3:material3:1.3.0") implementation("androidx.compose.ui:ui-tooling-preview:1.7.0") debugImplementation("androidx.compose.ui:ui-tooling:1.7.0") implementation("androidx.activity:activity-compose:1.8.2") } repositories { maven { url = uri("https://maven.aliyun.com/repository/public") } } build sync时报错如下: Failed to resolve: com.openinstall:openinstall-sdk:latest_version build output时报错如下: FAILURE: Build completed with 10 failures. 1: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:mergeReleaseNativeLibs'. > Could not resolve all files for configuration ':app:releaseRuntimeClasspath'. > Could not find com.openinstall:openinstall-sdk:latest_version. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://repo.maven.apache.org/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://maven.aliyun.com/repository/public/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://dl.bintray.com/openinstall/maven/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom Required by: project :app * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. ============================================================================== 2: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:checkReleaseDuplicateClasses'. > Could not resolve all files for configuration ':app:releaseRuntimeClasspath'. > Could not find com.openinstall:openinstall-sdk:latest_version. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://repo.maven.apache.org/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://maven.aliyun.com/repository/public/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://dl.bintray.com/openinstall/maven/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom Required by: project :app * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. ============================================================================== 3: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:checkReleaseAarMetadata'. > Could not resolve all files for configuration ':app:releaseRuntimeClasspath'. > Could not find com.openinstall:openinstall-sdk:latest_version. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://repo.maven.apache.org/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://maven.aliyun.com/repository/public/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://dl.bintray.com/openinstall/maven/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom Required by: project :app * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. ============================================================================== 4: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:mapReleaseSourceSetPaths'. > Could not resolve all files for configuration ':app:releaseRuntimeClasspath'. > Could not find com.openinstall:openinstall-sdk:latest_version. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://repo.maven.apache.org/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://maven.aliyun.com/repository/public/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://dl.bintray.com/openinstall/maven/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom Required by: project :app * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. ============================================================================== 5: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:mergeReleaseResources'. > Could not resolve all files for configuration ':app:releaseRuntimeClasspath'. > Could not find com.openinstall:openinstall-sdk:latest_version. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://repo.maven.apache.org/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://maven.aliyun.com/repository/public/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://dl.bintray.com/openinstall/maven/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom Required by: project :app * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. ============================================================================== 6: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:processReleaseMainManifest'. > Could not resolve all files for configuration ':app:releaseRuntimeClasspath'. > Could not find com.openinstall:openinstall-sdk:latest_version. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://repo.maven.apache.org/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://maven.aliyun.com/repository/public/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://dl.bintray.com/openinstall/maven/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom Required by: project :app * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. ============================================================================== 7: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:desugarReleaseFileDependencies'. > Could not resolve all files for configuration ':app:releaseRuntimeClasspath'. > Could not find com.openinstall:openinstall-sdk:latest_version. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://repo.maven.apache.org/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://maven.aliyun.com/repository/public/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://dl.bintray.com/openinstall/maven/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom Required by: project :app * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. ============================================================================== 8: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:mergeReleaseArtProfile'. > Could not resolve all files for configuration ':app:releaseRuntimeClasspath'. > Could not find com.openinstall:openinstall-sdk:latest_version. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://repo.maven.apache.org/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://maven.aliyun.com/repository/public/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://dl.bintray.com/openinstall/maven/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom Required by: project :app * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. ============================================================================== 9: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:mergeReleaseAssets'. > Could not resolve all files for configuration ':app:releaseRuntimeClasspath'. > Could not find com.openinstall:openinstall-sdk:latest_version. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://repo.maven.apache.org/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://maven.aliyun.com/repository/public/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://dl.bintray.com/openinstall/maven/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom Required by: project :app * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. ============================================================================== 10: Task failed with an exception. ----------- * What went wrong: Execution failed for task ':app:collectReleaseDependencies'. > Could not resolve all files for configuration ':app:releaseRuntimeClasspath'. > Could not find com.openinstall:openinstall-sdk:latest_version. Searched in the following locations: - https://dl.google.com/dl/android/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://repo.maven.apache.org/maven2/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://maven.aliyun.com/repository/public/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom - https://dl.bintray.com/openinstall/maven/com/openinstall/openinstall-sdk/latest_version/openinstall-sdk-latest_version.pom Required by: project :app * Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. ============================================================================== Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. For more on this, please refer to https://docs.gradle.org/8.14.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. BUILD FAILED in 5s
06-06
apply plugin: "com.android.application" apply plugin: "org.jetbrains.kotlin.android" apply plugin: "com.facebook.react" /** * This is the configuration block to customize your React Native Android app. * By default you don't need to apply any configuration, just uncomment the lines you need. */ react { /* Folders */ // The root of your project, i.e. where "package.json" lives. Default is '../..' // root = file("../../") // The folder where the react-native NPM package is. Default is ../../node_modules/react-native // reactNativeDir = file("../../node_modules/react-native") // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen // codegenDir = file("../../node_modules/@react-native/codegen") // The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js // cliFile = file("../../node_modules/react-native/cli.js") /* Variants */ // The list of variants to that are debuggable. For those we're going to // skip the bundling of the JS bundle and the assets. By default is just 'debug'. // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. // debuggableVariants = ["liteDebug", "prodDebug"] /* Bundling */ // A list containing the node command and its flags. Default is just 'node'. // nodeExecutableAndArgs = ["node"] // // The command to run when bundling. By default is 'bundle' // bundleCommand = "ram-bundle" // // The path to the CLI configuration file. Default is empty. // bundleConfig = file(../rn-cli.config.js) // // The name of the generated asset file containing your JS bundle // bundleAssetName = "MyApplication.android.bundle" // // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' // entryFile = file("../js/MyApplication.android.js") // // A list of extra flags to pass to the 'bundle' commands. // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle // extraPackagerArgs = [] /* Hermes Commands */ // The hermes compiler command to run. By default it is 'hermesc' // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" // // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" // hermesFlags = ["-O", "-output-source-map"] /* Autolinking */ autolinkLibrariesWithApp() } /** * Set this to true to Run Proguard on Release builds to minify the Java bytecode. */ def enableProguardInReleaseBuilds = false /** * The preferred build flavor of JavaScriptCore (JSC) * * For example, to use the international variant, you can use: * `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+' android { ndkVersion rootProject.ext.ndkVersion buildToolsVersion rootProject.ext.buildToolsVersion compileSdk rootProject.ext.compileSdkVersion namespace "com.magicmirrorapp" defaultConfig { applicationId "com.magicmirrorapp" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0" } signingConfigs { debug { storeFile file('debug.keystore') storePassword 'android' keyAlias 'androiddebugkey' keyPassword 'android' } } buildTypes { debug { signingConfig signingConfigs.debug } release { // Caution! In production, you need to generate your own keystore file. // see https://reactnative.dev/docs/signed-apk-android. signingConfig signingConfigs.debug minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) // The version of react-native is set by the React Native Gradle Plugin implementation("com.facebook.react:react-android") if (hermesEnabled.toBoolean()) { implementation("com.facebook.react:hermes-android") } else { implementation jscFlavor } } 这是我现在android/app/build.gradle文件内容,请帮我分析存在的问题
最新发布
07-25
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_STATIC_JAVA_LIBRARIES := fmodjar include $(BUILD_PACKAGE) include $(CLEAR_VARS) LOCAL_MODULE := fmod LOCAL_SRC_FILES := $(LOCAL_PATH)/../../../fmod/api/lib/$(TARGET_ARCH_ABI)/libfmod.so LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../fmod/api/inc include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := fmodL LOCAL_SRC_FILES := $(LOCAL_PATH)/../../../fmod/api/lib/$(TARGET_ARCH_ABI)/libfmodL.so LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../../fmod/api/inc include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := fmodjar:libs/fmod.jar include $(BUILD_MULTI_PREBUILT) include $(CLEAR_VARS) $(call import-add-path,$(LOCAL_PATH)/../../cocos2d) $(call import-add-path,$(LOCAL_PATH)/../../cocos2d/external) $(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos) LOCAL_MODULE := youme_voice_engine LOCAL_SRC_FILES := $(LOCAL_PATH)/../../../youme_voice_engine/lib/android/$(TARGET_ARCH_ABI)/libyoume_voice_engine.so include $(PREBUILT_SHARED_LIBRARY) cmd-strip = $(TOOLCHAIN_PREFIX)strip --strip-debug -x $1 LOCAL_CFLAGS += -fvisibility=hidden LOCAL_CPPFLAGS += -fvisibility=hidden LOCAL_MODULE := cocos2dcpp_shared LOCAL_MODULE_FILENAME := libcocos2dcpp FILE_LIST := hellocpp/main.cpp \ ../../Classes/AppDelegate.cpp \ ../../Classes/QuickSDKAndroid.cpp \ ../../Classes/YouMeVoiceEngineImp.cpp \ ../../Classes/QuickSDK.cpp FILE_LIST += $(wildcard $(LOCAL_PATH)/../../Classes/*/*.cpp) LOCAL_SRC_FILES := $(FILE_LIST:$(LOCAL_PATH)/%=%) LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes \ $(LOCAL_PATH)/../../cocos2d/libiconv/include \ $(LOCAL_PATH)/../../cocos2d/libiconv/libcharset \ $(LOCAL_PATH)/../../cocos2d/libiconv/lib \ $(LOCAL_PATH)/../../cocos2d/libiconv/libcharset/include \ $(LOCAL_PATH)/../../cocos2d/libiconv/srclib \ $(LOCAL_PATH)/../../cocos2d/libiconv \ $(LOCAL_PATH)/../../Classes \ $(LOCAL_PATH)/../../youme_voice_engine/include # _COCOS_HEADER_ANDROID_BEGIN # _COCOS_HEADER_ANDROID_END LOCAL_STATIC_LIBRARIES := cc_static LOCAL_STATIC_LIBRARIES += libiconv_static LOCAL_SHARED_LIBRARIES := fmodL LOCAL_SHARED_LIBRARIES += fmod LOCAL_SHARED_LIBRARIES += youme_voice_engine # _COCOS_LIB_ANDROID_BEGIN # _COCOS_LIB_ANDROID_END include $(BUILD_SHARED_LIBRARY) $(call import-module,.) $(call import-module,libiconv) # _COCOS_LIB_IMPORT_ANDROID_BEGIN # _COCOS_LIB_IMPORT_ANDROID_END C:\Users\Administrator\Desktop\client\proj.android\libs\arm64-v8a文件.so文件都在这个文件夹下啊。你看下路径是否正确?
07-24
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值