问题描述: 我面临的问题是,经过一些升级(Android Studio、Gradle 插件等)后,不再会在应用程序包中创建调试符号。我当前的设置是:
复制步骤:
plugins {
id 'com.android.application' version '8.0.0' apply false
id 'com.android.library' version '8.0.0' apply false
id 'org.jetbrains.kotlin.android' version '1.8.21' apply false
}
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.example.demoapplication'
compileSdk 33
defaultConfig {
applicationId "com.example.demoapplication"
minSdk 28
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
ndk {
debugSymbolLevel 'FULL'
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
buildFeatures {
viewBinding true
}
ndkVersion '25.1.8937393'
}
dependencies {
implementation 'androidx.core:core-ktx:1.10.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}
注意 minifyEnabled 设置为 true,添加了 ndkVersion 25.1.8937393 并且 debugSymbolLevel 声明为“FULL” 选择 Build bundle 时,应用程序可以正常构建 在分析应用程序包时,app-release.aab 文件中没有调试符号(请参见下面的屏幕截图): 图片.png
在我的“普通”应用程序中,同样的事情发生了。我必须注意,过去创建了调试符号,在升级到更新版本(AGP 等)的某个时候它停止创建它们(我不知道是什么原因造成的)。
我试过的
我不知道我在这里错过了什么。我也找不到任何日志文件可以告诉我为什么它不起作用。
这个 github 存储库包含演示未创建调试符号的演示应用程序(至少在我的系统上): https://github.com/Chris-NL/Demo_Application
谢谢大家的帮助