问题
After changing my top level build.gradle to use the Android Plugin for Gradle 3.0.0-beta3
along with Gradle 4.1
, AirWatch
can't read the info (like versionCode and versionName) from the APK.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
roomVersion = '1.0.0-alpha9'
supportLibVersion = '26.0.1'
}
Is this a known issue? Any workaround?
回答1:
Airwatch has an issue with the new AAPT2 tool which seems to compile the Manifest.xml file in a compressed form in contrast to AAPT. AAPT2 became the standard with Android Studio 3 but you can get back easily to AAPT by putting the line
android.enableAapt2=false
in the gradle.properties file of your project. Solved at least in our project the problem.
回答2:
I don't have enough reputation to comment, but I just wanted to ask, if you have found out anything new about this topic, since our clients use AirWatch and we have run into a similar problem after updating gradle.
Specifically after updating from Android Studio 2 to Android Studio 3 and thus changing all gradle stuff coming with it.
回答3:
As of this writing, Airwatch has a limitation where it will not update the app compiled with Android gradle plugin 3.0.
There are 2 work arounds. 1. Build the apk using the gradle plugin 2.3.3 or 2. Upload the apk built using gradle plugin 3.0 as a separate app on the console. Define App/ID version code manually and deploy.
来源:https://stackoverflow.com/questions/45967668/airwatch-seems-to-be-incompatible-with-android-plugin-for-gradle-3-0-0-beta1