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 'Messages' view.
No cached version of com.android.tools.lint:lint-gradle:26.1.1 available for offline mode.
this is my android studio details :
Android Studio 3.1.1
Build #AI-173.4697961, built on April 4, 2018
JRE: 1.8.0_152-release-1024-b02 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
this block for signing the apk :
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releaseconfig
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
} signingConfigs {
releaseconfig {
keyAlias 'release_key'
keyPassword 'xxxxx'
storeFile file('xxxxxx)
storePassword 'xxxx'
}
}
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.
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'
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'
Try Setting debug to True in release mode though debuggable should be set to false in release APK but currently this is the solution i get.
release {
debuggable true
}
Update
Adding the following code in gradle to make it work
lintOptions {
checkReleaseBuilds false
}
Check Settings > Build, Execution, Deployment > Compiler to see if Command-line Options contains --offline See this answer.
please open your AndroidStudio and find click File and then find settings.
second you click compiler and then find Command-line Options: remove --offline
lintOptions {
abortOnError false
}
//add this on gradle file inside android tag
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
Related
I used to generate a signed apk from Android Studio and everything was working well until I updated Android Studio to 3.3. It generates an apk but after I try to install it, it says: App Not Installed!
My Trial was by:
Click on build
Generate Signed Apk
Choose APK and click Next
Insert the Key Store Path, Key Store Password, Key Alias, Key Password
Click Next
Choose Release Variant
Click Finish
The Apk is generated but it's not signed! What is the problem ?
Here is my app build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 27
defaultConfig {
applicationId "com.twobreathe.soft2breathe"
minSdkVersion 23
targetSdkVersion 27
versionCode 9
versionName "1.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
}
}
vectorDrawables {
useSupportLibrary true
}
resConfigs "en", "ja"
}
signingConfigs {
release {
keyAlias "[my key alias]"
keyPassword "[my key password]"
storeFile file("[path to the keystore file]")
storePassword "[my store password]"
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
shrinkResources true
pseudoLocalesEnabled false
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/fluidsynth/android/CMakeLists.txt"
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
dataBinding {
enabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildToolsVersion '28.0.3'
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.github.parse-community.Parse-SDK-Android:parse:1.18.4'
implementation 'com.jjoe64:graphview:4.2.2'
implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.orhanobut:hawk:2.0.1'
implementation 'xyz.sahildave:arclayout:1.0.0'
implementation 'com.mikhaellopez:circularprogressbar:2.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'com.github.GrenderG:Toasty:1.3.0'
implementation 'com.kyleduo.switchbutton:library:2.0.0'
implementation 'com.github.franmontiel:LocaleChanger:0.9.2'
implementation 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
}
After updating to 3.3, many problems are occuring related to signing an APK. Sometime it doesn't sign the apk and sometime it says the key is not private.
Well i also faced this problem after upgrading to android studio 3.3 and i resolved in 3 steps. But firstly make sure you backup your whole project.
In Android Studio goto File > Project Structure and untick from "use embedded JDK" then click OK
Goto Computer Settings (system settings) (win + pause key) then go to Advanced system settings>Environment variables. if JAVA_HOME not present then add it and set path to your installed JDK.
As i couldn't find a direct approach to modify jdk path in my project that is upgraded in some way to android studio 3.3 settings, i did following(for the last step) BUT MAKE SURE YOU MAKE BACKUP BEFORE THIS.
To make sure where i am guiding come to project view, I deleted ".grade", ".idea", "capture", "gradle" folders from the root and "build", "release", "lib" folder from "app" leaving "src" as it is. Deleted root.iml and did not delete app.iml file Then rebuild the project and then created the Signed package.
It went successful after 2 try. To be very honest i did the last step twice by restoring files from backup. As deleting these folders i messed up 1 time.
Not strictly related, but I ended up in this questions when searching for a fix to my problem.
In my case I forgot to remove 'debuggable true' for one of my non-debug built-types. When I was generating the bundle the google play store wouldn't complain about it just said that it wasn't signed. But when I tried uploading an apk it showed the true error.
From your Gradle its visible that you have not configured your Signing Config with it.
Please check image below:
Step 1:
Go to your project settings > select your module (Let's say "app") > go to signing > enter proper information and keystore.jks file
Step 2:
Go to Build Types > select Release type > assign signing config as you created on step 1. > after that your gradle will have config as there in image.
Step 3:
Try generating signed APK.
It will be success!!!
Happy Coding..
Double check both of the values on the final dialog, labelled by "Signature Versions".
For more information please check the following link:
https://developer.android.com/about/versions/nougat/android-7.0#apk_signature_v2
Anyway this question seems duplicate as the following:
android studio: release apk is not signed
friend
when you go for build the signed apk
now in android studio 3.3 , you will 2 option for build the signed apk.
1. Android App Bundle
2.APK
i will suggest to use option 2
select option 2 and Click on Next button now studio ask for your password details
now fill all details and
select Remember password checkbox for feature and now next .
now again studio ask for debug and release build confirmation
now here select release and select 2 checkbox at bottom and then continue
hope your signed apk will be generate .
When generating an APK, make sure both the signature types are checked, otherwise Fabric (and other places) may not recognise it as signed.
Additionally you probably want to remove debuggable true from your release config, as debuggable builds can't be uploaded to Google Play. There's a chance this is also causing an issue.
Try to sign it using command-line tools. I may help you to identify the problem.
(https://developer.android.com/studio/build/building-cmdline).
In my case, it was JAVA_HOME problem (as in #Vanshaj Daga answer).
When I add the dependency:
compile 'net.bytebuddy:byte-buddy-android:0.7.8'
in my app, I get this error:
Conflict with dependency 'net.bytebuddy:byte-buddy'. Resolved versions for app (0.7.8) and test app (0.6.14) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
I have visited http://g.co/androidstudio/app-test-app-conflict and it says:
Gradle build will fail if the main APK and the test APK use the same
library (e.g. Guava) but in different versions.[...] To make the build
succeed, just make sure both APKs use the same version
But I don't know what it means.
Can you help me? Thanks.
build.gradle
...
buildTypes {
all {
//just build some config fields
}
demo.initWith(buildTypes.debug)
demo {
//just build some config fields
}
devel.initWith(buildTypes.debug)
devel {
//just build some config fields
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.gg
//just build some config fields
}
}
lintOptions {
checkReleaseBuilds false
abortOnError false
}
...
You can force the version in your test using:
androidTestCompile 'net.bytebuddy:byte-buddy-android:0.7.8'
You can force the version without adding an extraneous dependency by adding this to your gradle file
configurations.all {
resolutionStrategy {
force 'net.bytebuddy:byte-buddy-android:0.7.8'
}
}
I'm struggling with coming to terms with Andoid Studio after years working with Eclipse. I've imported an existing Eclipse simple project into AStudio 1.1.0 and altough it builds an APK
Directory of
C:\dev\projects\AndroidStudio\DiddyOsmdroid\TinyOsmdroid\build\out
puts\apk
25/02/2015 17:02 176,517 TinyOsmdroid-debug-unaligned.apk
25/02/2015 17:02 176,518 TinyOsmdroid-debug.apk
It doesn't deploy to a tablet connected via USB. (It did the first time I tried it, but not now) I've edited the run configurations to try both 'USB' and 'choose'. I try to deploy and run by double clicking assembleDebug as suggested in the docs. The device is visible in the Android window, in that Log lines are shown.
My gradle file looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 7
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "osmdemo.demo"
minSdkVersion 3
targetSdkVersion 3
}
signingConfigs {
release {
storeFile file("c:/users/me/some.keystore")
storePassword "xxxxxxxxxxx"
keyAlias "some_alias"
keyPassword "yyyyyy"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
}
}
}
dependencies {
compile files('libs/osmdroid-android-4.1.jar')
compile files('libs/slf4j-android-1.5.8.jar')
}
I'd be grateful to get any suggestions.
Gradle wont excute the app on the emulator/device. It will only build and install. You have to run an adb command to run the app. This is essentially what the Run button on Android Studio does for you.
I have an Android library project and an app, which uses that library project. In the app's build.gradle file I have ProGuard obfuscate the whole app including the library project code:
//from the app project
buildTypes{
release {
runProguard true
proguardFile 'proguard-project.txt'
}
debug{
runProguard false
}
}
All works well, the lib project and the app project both get obfuscated just fine.
However, I want to build my lib project "standalone", so I can distribute it without the app project. This of course means obfuscating the lib project on its own.
I cannot do this by using the buildTypes code in the lib-projects build.gradle and simply running proGuard, since this would break the app-project build, because then building the app would compile its code agains already-obfuscated lib-project code... :-)
What I need is a possibility to run ProGuard only if I build the lib-project in "standalone" mode, e.g. by passing a parameter, or executing a special task.
Can anyone point me in the right direction?
solved it myself. In the lib-project's build file I have two buildtypes and I publish them both:
publishNonDefault true
and the build types:
buildTypes {
debug {
debuggable true
runProguard false
}
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt'
}
}
this causes the debug and release APK to be created. In my app project's build file I then add an explicit dependency to the debug configuration by stating the dependency as follows:
dependencies{
compile project(path: ':FancyLibProject', configuration: 'debug')
//...
}
Of course in the app-project I also have two build types debug and release, which in turn invoke ProGuard in the same way as for the lib-project.
Note: I omitted the signing configs for the release build - without those the APK will cannot be installed!
I'm trying to build an android gradle project using eclipse, but i get this error when building the project using the command line:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:crashlyticsCleanupResourcesRelease'.
> Crashlytics Developer Tools error.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
I'm using gradle version 1.10 also tried gradle version 1.12 but i get the same error
and here is my build.gradle file :
buildscript {
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.10.+'
}
}
apply plugin: 'android-sdk-manager'
apply plugin: 'android'
apply plugin: 'crashlytics'
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
android {
compileSdkVersion 19
buildToolsVersion "19.1.0"
lintOptions.checkReleaseBuilds false
defaultConfig {
minSdkVersion 7
targetSdkVersion 19
}
signingConfigs {
release {
storeFile file(STORE_FILE)
storePassword STORE_PASSWORD
keyAlias KEY_ALIAS
keyPassword KEY_PASSWORD
}
}
buildTypes {
debug {
ext.enableCrashlytics = false
buildConfigField "boolean", "LOG_CRASHES", "false"
}
release {
buildConfigField "boolean", "LOG_CRASHES", "true"
runProguard true
proguardFile 'proguard.cfg'
signingConfig signingConfigs.release
}
}
}
dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.android.support:support-v4:19.1.0'
compile 'com.crashlytics.android:crashlytics:1.+'
}
Had a similar error trying to use Fabric's Twitter Kit
Error:Execution failed for task ':app:fabricCleanupResourcesDevDebug'.
> Crashlytics Developer Tools error.
Detailed error
ERROR - Crashlytics Developer Tools error.
java.lang.IllegalArgumentException: Crashlytics found an invalid API key: XXXXXXXXX.
Check the Crashlytics plugin to make sure that the application has been added successfully!
Contact support#fabric.io for assistance.
After login in Fabric, download the AndroidStudio plugin and let it configure everything all worked fine.
(Btw, I really don't like this setup flow)
EDIT: It also can be done without install the AndroidStudio plugin. Follow these instructions from the Fabric site https://fabric.io/downloads/gradle
This is not a solution to the original question, but you can also run into this error another way. If you are following docs for the Gradle Advanced Setup you might have included the following code
debug {
ext.enableCrashlytics = false
}
Now if you are testing your application you may have tried to set ext.enableCrashlytics = true instead. Apparently this will cause errors for Crashlytics though and is not a valid value for this variable.
So if you want Crashlytics enabled for debug builds you'll need to comment out this line while you are testing or remove it altogether.
By adding this line to your Application's Manifest inside tag
<meta-data
android:name="io.fabric.ApiKey"
android:value="XXXXXXXXXXXXXXX" />
I resolved this issue
I fixed this issue by replacing "io.fabric.ApiKey" with "com.crashlytics.ApiKey" in AndroidManifest.xml (I don't like to change the Crashlytics lib). So the final one is:
<meta-data
android:name="com.crashlytics.ApiKey"
android:value="xxxxxxxx" />
<meta-data
android:name="com.crashlytics.ApiKey"
android:value="your key" />
I had simillar issue. Just add these line to your Android manifest file.
So I was having this issue and resolved it.
Basically, I was trying to use #string/crashlytics_key_prod, instead of putting in the actual key.
Replacing "#string/crashlytics_key_prod" by the actual key in the manifest resolved this issue for me.