2016-01-24 75 views
2

我阅读了android文档的“构建系统”部分:http://developer.android.com/sdk/installing/studio-build.html我的新版本变种的apk在哪里?

因此构建变体由product_flavor-build_type组成。我有这样的build.gradle:

buildTypes { 
    debug { 
     applicationIdSuffix '.debug' 
     debuggable true 
     minifyEnabled !skipProguard 
     shrinkResources true 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
     signingConfig signingConfigs.debug 
     zipAlignEnabled false 
    } 
    debugtest { 
     // unit tests 
     applicationIdSuffix '.test' 
     debuggable true 
     minifyEnabled false 
     shrinkResources true 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
     signingConfig signingConfigs.debug 
     zipAlignEnabled false 
    } 
    release { 
     minifyEnabled true 
     shrinkResources true 
     debuggable false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 
     signingConfig signingConfigs.release 
    } 
} 

productFlavors { 
    internal { 
     applicationId "${project.applicationId}.internal" 
     buildConfigField 'boolean', 'EXPERIMENTAL', 'true' 
     buildConfigField 'boolean', 'FAKE_HTTP_RESPONSE', 'false' 
    } 
    production { 
     applicationId project.applicationId 
     buildConfigField 'boolean', 'EXPERIMENTAL', 'false' 
     buildConfigField 'boolean', 'FAKE_HTTP_RESPONSE', 'false' 
    } 
    automation { 
     applicationId "${project.applicationId}.automation" 
     buildConfigField 'boolean', 'EXPERIMENTAL', 'true' 
     buildConfigField 'boolean', 'FAKE_HTTP_RESPONSE', 'true' 
    } 
} 

我想创建移动调试自动化unaligned.apk,这样我可以匕首模块中使用“FAKE_HTTP_RESPONSE” BuildConfig变量。

但是当我点击Android Studio中的“Build Variants”时,我看到一个构建变体 - “internalDebug”。我期望看到9个构建变体(buildType * productFlavor)。在我的项目目录

看,我看到了下面的APK:

my_app应用/移动:移动release.apk,移动调试unaligned.apk

my_app应用/移动/编译/输出/ APK :mobile-internal-debug-unaligned.apk

如何生成我的新“自动化”apk?

+0

您应该能够在Build Variants窗口中看到所有9个Build版本。你可以选择一个,然后从菜单构建或运行应用程序,它会生成它的apk。如果您没有看到所有生成变体,那么您必须检查您的productFlavors文件夹是否具有正确的名称。 – Sharj

+0

尝试重建您的项目。 –

回答

0

PLZ点击它改变:

enter image description here

如果它不工作,重建项目。

相关问题