Android Studio Flamingo 不再在应用程序包中创建调试符号

问题描述 投票:0回答:0

问题描述: 我面临的问题是,经过一些升级(Android Studio、Gradle 插件等)后,不再会在应用程序包中创建调试符号。我当前的设置是:

  • 安卓火烈鸟 2022.2.1
  • Android Gradle 插件 8.0.0
  • 摇篮版本 8.1.1
  • 构建工具 33.0.2
  • NDK 25.1.8937393
  • CMake 3.22.1
  • 科特林 1.8.21
  • Windows 10 Pro 22H2(包含所有最新更新)

复制步骤:

  • 创建一个新项目并从模板中选择“Phone and Tablet” -> “Basic Views Activity”
  • 调用项目“Demo Application”并将 Minimum SDK 设置为 API 28,将所有其他设置保留为默认值
  • 使用项目的build.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
    }

  • 按如下所述使用应用程序的build.gradle:

    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 等)的某个时候它停止创建它们(我不知道是什么原因造成的)。

我试过的

  • 尝试了几个不同的 Android Gradle Plugin 版本
  • 尝试了各种 NDK 版本(更高和更低)
  • 尝试了不同的 CMake 版本
  • 将 ndkPath 添加到我的 build.gradle
  • 尝试从 build.gradle 文件中删除 ndkVersion

我不知道我在这里错过了什么。我也找不到任何日志文件可以告诉我为什么它不起作用。

这个 github 存储库包含演示未创建调试符号的演示应用程序(至少在我的系统上): https://github.com/Chris-NL/Demo_Application

谢谢大家的帮助

android-studio android-ndk android-gradle-plugin debug-symbols
© www.soinside.com 2019 - 2024. All rights reserved.