search

Home  >  Q&A  >  body text

android - Apk 中找不到r类文件

使用Android Studio打包apk,解压在里面找不到R相关的文件,使用debug 模式生成的apk里面却有,这是build.gradle配置
` buildTypes {

    release {
        minifyEnabled true
        debuggable false
        buildConfigField("boolean", "LOG_DEBUG", "false")
        versionNameSuffix "-release"
        zipAlignEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

        signingConfig signingConfigs.release
    }

    debug {
        applicationIdSuffix ".debug"
        debuggable true
        shrinkResources false
        buildConfigField("boolean", "LOG_DEBUG", "true")
        versionNameSuffix "-debug"
        zipAlignEnabled true

        signingConfig signingConfigs.debug
    }
}

productFlavors {
    wandoujia {
        applicationIdSuffix ".wandoujia"
    }

    xiaomi {
        applicationIdSuffix ".xiaomi"
        manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
    }
}`

不是什么非要解决的问题,只是觉得这个挺奇怪的,如果找不到r类文件,又怎么匹配到资源文件的呢?

PHP中文网PHP中文网2773 days ago407

reply all(2)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:58:58

    Use as, or try rebuilding

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:58:58

    In the default configuration, the R file will not be included in the apk. When compiling, the value in the R file referenced in the code will be replaced with a specific value. You can just find an activity to see the ID of the layout file. It is a specific Numbers

    reply
    0
  • Cancelreply