我创建了一个新的 Flutter 项目,文件中的 minSdkVersion 如下所示app/build.gradle:
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.projectname"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Run Code Online (Sandbox Code Playgroud)
set的值在哪里flutter.minSdkVersion?
请注意,以前,该配置值如下所示:
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.projectname"
minSdkVersion 19 //*** This is the part that needs to be changed, previously was 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Run Code Online (Sandbox Code Playgroud)
另外,这是文件的内容android/local.properties:
sdk.dir=/Users/usernaem/Library/Android/sdk
flutter.sdk=/Users/username/flutter
flutter.buildMode=release
flutter.versionName=1.0.0
flutter.versionCode=1
Run Code Online (Sandbox Code Playgroud)
可以看到,flutter.minSdkVersion …
在我的项目minSdkVersion = 10中,在库中它是11.
我明白了:
BUILD_FAILED - Manifest merger failed : uses-sdk:minSdkVersion 10 cannot be smaller than version 11 declared in library.
Run Code Online (Sandbox Code Playgroud)
如何忽略库的minSdkVersion?
android android-studio android-gradle-plugin android-min-sdk
如何仅在调试模式下使用特定的minSdkVersion?我想将minSdkVersion 21用于调试模式,但minSdkVersion 15用于发布.我不想为此使用口味,因为会给你带来麻烦.
我认为可能是这样(但不起作用):
defaultConfig {
applicationId "blacktoad.com.flapprototipo"
minSdkVersion 15
debug{
minSdkVersion 21
}
targetSdkVersion 23
versionCode 42
versionName "1.72"
multiDexEnabled true
}
Run Code Online (Sandbox Code Playgroud) 最近,我们将最低支持的 SDK 从 API 21 提升到了 24。
显然,这一变化导致我们的 APK 大小从 65mb 增加到 103mb。从Android studio中的APK分析可以看出,基本上都是.so文件大小翻倍了。
但为什么会这样呢?gradle 属性没有改变,只有 min sdk。
关于如何再次减小 APK 大小的任何想法?
android apk android-min-sdk android-6.0-marshmallow android-native-library
Android Studio(版本 4.1.1)在我的 xml 布局文件中显示使用 onClick 的视图的警告(警告 ID:UsingOnClickInXml,旧版本的平台无法正确支持解析 Android:onClick)。当我运行代码检查器时,这些也会显示在 lint 警告中。看来 Android Studio 没有使用我在 build.gradle (应用程序)文件中设置的 minSdkVerion (16)。
<Button
android:id="@+id/btn_Splash_PrivacyPolicy"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onClick" //This gets highlighted with the warning
android:text="@string/dialog_button_privacyPolicy"
style="?android:attr/buttonBarButtonStyle"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
/>
Run Code Online (Sandbox Code Playgroud)
以下是我的 build.gradle(应用程序)文件的摘录:
android {
compileSdkVersion 30
buildToolsVersion '30.0.3'
defaultConfig {
...
minSdkVersion 16
targetSdkVersion 30
...
}
...
}
Run Code Online (Sandbox Code Playgroud)
这似乎保留在我合并的 AndroidManifest.xml 中(我没有直接在清单中设置 minSdkVerion,仅在 build.gradle 文件中设置)。摘自合并的 AndroidManifest.xml
<manifest
...
<uses-sdk
android.minSdkVersion="16"
android.targetSdkVersion="30" />
...
Run Code Online (Sandbox Code Playgroud)
我如何在关联的 Activity 中使用 onClick 的示例:
android {
compileSdkVersion 30
buildToolsVersion '30.0.3'
defaultConfig { …Run Code Online (Sandbox Code Playgroud) 我有一个相对较小且简单的应用程序,它始终生成约 17 MB 的发布 APK 文件。不久前,我注意到 APK 大小增加到了惊人的(对于这个应用程序)39 MB。我追踪了导致它的更改,结果发现相同的代码库,其中唯一的更改是minSdkVersion从 16 到 26 ,没有任何其他更改导致 APK 增加。
奇怪的是,当我解压 APK 时,解压后的目录在磁盘上占用了约 40 MB 的空间。有一些更改,但所有更改都在非常小的文件中,就像 26 版本中缺少一些布局一样,可以忽略不计。40 MB 中最大的部分是 lib 文件夹,其中包含 *.so 库,总计 37 MB,但它们在两个 APK 版本中是相同的。(该应用程序是使用 构建的 Flutter 应用程序flutter build apk --release。)
我实际上不希望也不需要minSdkVersion26,并且会恢复此更改,但我很好奇:
minSdkVersion版本之间的尺寸急剧增加?minSdkVersion16 版本时的压缩效果更好?minSdkVersion在他们的设备上占用更多空间吗?我使用的是Android Studio版本1.2.2.
我的项目的最小sdk是7,我想使用谷歌播放服务,这需要min sdk 9及以上.所以我使用下面的方法来覆盖图书馆.
虽然我收到以下错误:
错误:任务':processDebugManifest'的执行失败.
清单合并失败:uses-sdk:minSdkVersion 7不能小于库D中声明的版本9:\ project_name\build\intermediates\explosion-aar\com.google.android.gms\play-services-ads\7.5.0\AndroidManifest.xml建议:使用工具:overrideLibrary ="com.google.android.gms.ads"强制使用
我坚持到这一点,不能继续前进.任何帮助都非常感谢.
android android-manifest admob google-play-services android-min-sdk
如何确定我的项目中使用的最低 API 级别或最高 API 级别?有什么方法可以确定我项目中的哪一部分代码使用了哪个 API 级别?
无论如何,android studio 是否可以确定我的项目中使用的最低 API 级别和最高 API 级别?例如,所有任务的“TODO”跟踪等,我们在 Android Studio 中是否有任何功能来确定我的项目中使用的最低 API 级别和最高 API 级别?
我是新手,所以请多多包涵。
据我所知,android studio 中设置的默认最小 SDK 是 15。我读过我应该增加它,因为没有多少(或可能没有)仍在使用该 android 版本。另外,我计划在 android studio 中使用一些仅适用于更高 API 的新功能。
请问您现在的最低SDK版本是多少,以指导我选择我的。
AndroidManifest.xml文件发出警告-
Attribute hardwareAccelerated is only used in API level 11 and higher(current min is 1)
Attribute windowSoftInputMode is only used in API level 3 and higher(current min is 1)
Run Code Online (Sandbox Code Playgroud)
和
Should set android:versionCode to specify the application version
Should set android:versionName to specify the application version
Run Code Online (Sandbox Code Playgroud)
也
App is not indexable by Google Search;
Run Code Online (Sandbox Code Playgroud)
当app / build.gradle文件读取时-
compileSdkVersion 28
minSdkVersion 16
targetSdkVersion 28
versionCode flutterVersionCode.toInteger() // 1
versionName flutterVersionName // '1.0'
Run Code Online (Sandbox Code Playgroud)
这些警告是最近开始发生的,没有任何新的升级。我较早的flutter项目从未遇到过这些警告,并且仍然可以正常工作。
我尝试过的事情:
解决警告的原因:
<uses-sdk android:minSdkVersion="16" …Run Code Online (Sandbox Code Playgroud) android android-manifest build.gradle android-min-sdk flutter
android ×10
android-min-sdk ×10
apk ×2
flutter ×2
admob ×1
build.gradle ×1
gradle ×1
java ×1
lint ×1