在 Android Studio 中将 Build Type debuggable 设置为 True 不适用
Setting Build Type debuggable to True in Android Studio doesn't stick
我正在尝试为我的应用程序添加第二个构建类型(以便我可以在发布前使用 Proguard 对其进行测试)。我在 app/build.gradle 中进行了更改以反映我想要的内容:
debugPG {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationIdSuffix '.debugPG'
versionNameSuffix '.debugPG'
signingConfig signingConfigs.debug
}
当我尝试调试时,我收到一条错误消息:
Error running app:
Cannot debug application from module app on device
This application does not have the debuggable attribute enabled in its manifest.
If you have manually set it in the manifest, then remove it and let the IDE automatically assign it.
If you are using Gradle, make sure that your correct variant is debuggable.
我转到构建类型的 Android Studio 设置(构建/编辑构建类型...),选择 debugPG,并将 Debuggable 更改为 True。 (注意 - 它是灰色的,但允许我更改它)。但是,当我单击“确定”时,它不会保存首选项并且我再次收到错误消息。再次打开设置显示它仍然停留在 False。
我该如何解决这个问题?
您应该能够在 gradle 文件中将可调试添加到您的自定义构建类型:
debugPG {
...
debuggable true
}
如果这不起作用,您可能想尝试关闭混淆器。
从发布更改构建变体 --> 从 android studio 左下角调试。
我正在尝试为我的应用程序添加第二个构建类型(以便我可以在发布前使用 Proguard 对其进行测试)。我在 app/build.gradle 中进行了更改以反映我想要的内容:
debugPG {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationIdSuffix '.debugPG'
versionNameSuffix '.debugPG'
signingConfig signingConfigs.debug
}
当我尝试调试时,我收到一条错误消息:
Error running app:
Cannot debug application from module app on device
This application does not have the debuggable attribute enabled in its manifest.
If you have manually set it in the manifest, then remove it and let the IDE automatically assign it.
If you are using Gradle, make sure that your correct variant is debuggable.
我转到构建类型的 Android Studio 设置(构建/编辑构建类型...),选择 debugPG,并将 Debuggable 更改为 True。 (注意 - 它是灰色的,但允许我更改它)。但是,当我单击“确定”时,它不会保存首选项并且我再次收到错误消息。再次打开设置显示它仍然停留在 False。
我该如何解决这个问题?
您应该能够在 gradle 文件中将可调试添加到您的自定义构建类型:
debugPG {
...
debuggable true
}
如果这不起作用,您可能想尝试关闭混淆器。
从发布更改构建变体 --> 从 android studio 左下角调试。