简体   繁体   中英

Android: failing on building release apk

Is there any difference between running./gradlew assembleRelease and./gradlew app:assembleRelease. For some reason, the first one is not working for me, but the second one works just fine

./gradlew app:assembleRelease runs task named assembleRelease in module app whereas ./gradlew assembleRelease does that for all modules that has task with this name registered

You can run ./gradlew assembleRelease -m to see what tasks will be executed and to verify that it does run the app:assembleRelease too.

For some reason, the first one is not working for me, but the second one works just fine

What do you mean by " not working "? I assume you mean it does not produce output apk file - where do you look for output artifacts?

Just copy his lines in Proguard-rules.pro file

-dontskipnonpubliclibraryclasses
-dontobfuscate
-forceprocessing
-optimizationpasses 5

-ignorewarnings
-keep class * {
    public private *;
}

-keep class * extends android.app.Activity

-assumenosideeffects class android.util.Log {
  public static *** v(...);
  public static *** d(...);
  public static *** i(...);
  public static *** w(...);
  public static *** e(...);
}

I had the same error. I just replaced ./gradlew assembleRelease to. /gradlew app:assembleRelease. You should try.

EDIT: There's another way. After some research, I found this code subprojects { subproject -> afterEvaluate{ if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) { android { compileSdkVersion rootProject.ext.compileSdkVersion buildToolsVersion rootProject.ext.buildToolsVersion } } } } Put it before EXT In android/gladle. And you'll be able to keep ./gradlew assembleRelease

The problem was conflict with buildtools from dependencies vs buildtools from android project

Formato inválido ou desconhecido do arquivo /storage/emulated/0/Android/data/com.cprextract.rarzip/files/_rartemp_open_1573205040128/filename.ext

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM