Failed to generate apk from Android studio 3.1.1

后端 未结 8 787
被撕碎了的回忆
被撕碎了的回忆 2020-12-31 07:48

When I try to generate a signed APK, I found this issue :

10:58 Generate Signed APK: Errors while building APK. You can find the errors in the \'Messa

相关标签:
8条回答
  • 2020-12-31 08:22

    Please use Analyze > Inspect Code to inspect your code

    If your app could be compiled and running just fine but you failed to generate sign APK. For me, after running inspection it shows me a few errors in my code. I fixed all those errors then I could build sign APK just fine. Check this Answer for more option to fix this

    0 讨论(0)
  • 2020-12-31 08:24

    Per the Android Studio docs, your top-level build.gradle ought to have the google() repository added. Be sure to add it to the repositories under buildscript AND allprojects.

    The latter one is what I missed the first time I edited this today after upgrading and that led directly to a Could not find com.android.tools.lint:lint-gradle:26.1.1. when I tried to build a release APK.

    0 讨论(0)
  • 2020-12-31 08:24

    I think this version required updated libs and gradle. try to change to compileSdkVersion 27 and libaries as.

    implementation 'com.android.support:support-v4:27.1.0'
    

    and gradle ver,

    classpath 'com.android.tools.build:gradle:3.1.0'
    
    0 讨论(0)
  • 2020-12-31 08:25

    Check Settings > Build, Execution, Deployment > Compiler to see if Command-line Options contains --offline See this answer.

    0 讨论(0)
  • 2020-12-31 08:27

    Solved (works for me) changing gradle version in the project build.gradle:

    From this

    classpath 'com.android.tools.build:gradle:3.1.1'
    

    to this

    classpath 'com.android.tools.build:gradle:3.0.1'
    
    0 讨论(0)
  • 2020-12-31 08:34

    please open your AndroidStudio and find click File and then find settings.

    second you click compiler and then find Command-line Options: remove --offline

    0 讨论(0)
提交回复
热议问题