Unable to upload new APK file to Android Play store - android

I'm getting below error while trying to upload new APK file.
Upload failed
You uploaded a debuggable APK. For security reasons you need to
disable debugging before it can be published in Google Play.

If you're using Android Studio, the simplest way is to open the "Build Variant" toolbar on the left bottom and change it from "Debug" to "Release" then "Build" -> "Generated Signed APK".

In my case I had to add android:debuggable="false" into manifest.. Worked even without few days ago.

If you using maven and android-maven-plugin, add this to plugin configuration
<configuration>
<release>true</release>
</configuration>

Please note, even if you have a release entry in your gradle build with debuggable false, if debuggable is set to true in the AndroidManifest.xml, it will still fail to upload. Found a random subproject in mine that had it set to true even though the gradle build file was false for all sub projects.

In case someone still looking the answer. I had similar problem. In my case Google Api error was: Google Api Error: apkNotificationMessageKeyDebuggable: APK is marked as debuggable. - APK is marked as debuggable. During investigation I've found that inside BuildConfig.java file DEBUG constant equals true even though BUILD_TYPE == release. After several hours I've found this thread. So in my case the problem was in jacoco. After removing testCoverageEnabled = true for release build, DEBUG became false again.

Related

Nativescript: deploying a release to google-play gives warnings about unused, obfuscated and native native-code

I'm getting said errors in the Google Play console when I upload a new apk:
This App Bundle contains Java / Kotlin code, which can be
deobfuscated. We recommend uploading a deobfuscation file so that
your crashes and ANRs can be more easily analyzed and resolved
This App Bundle contains native code and you have not uploaded any
debugging symbols. We recommend uploading a symbol file so that your
crashes and ANRs can be more easily analyzed and resolved.
It seems like the first one can be fixed by adding minifyEnabled true to this part of the build.gradle file:
buildTypes {
release {
minifyEnabled true
signingConfig signingConfigs.release
}
}
The second one should be fixe by adding:
ndk { debugSymbolLevel 'FULL' }
But when I add this to the gradle-file, I get an error when building the app:
A problem occurred evaluating project ':app'. No signature of method:
build_1ermujkr3n2a9bpd0mitv774.android() is applicable for argument
types: (build_1ermujkr3n2a9bpd0mitv774$_run_closure10) values:
[build_1ermujkr3n2a9bpd0mitv774$_run_closure10#4a4868e2]
Furthermore, Google complains about the file size (unused code) and recommends (actually, demands) that I should use an App Bundle.
I found something on the web how to create one, but I have no idea how to do this with nativescript...
Anybody here with experience with the symbolLevel and app-bundles?
As a sidenote: It's interesting that Google shows these as warnings and not as errors and yet, you can't release the apk without fixing them. Shouldn't it be my call to decide if that warning actually matters to me or not?
You have to edit the app.gradle file, not the build.gradle. The build.gradle will be generated by Nativescript when you build the application.

Why Proguard runs despite having minifyEnabled in gradle config?

According to documentation setting minifyEnabled to false must disable ProGuard run
integration {
minifyEnabled false
versionNameSuffix "-int"}
But the ProGuard is still started by Gradle! Any ideas why?
You will need to change the Build Variant to use one of the integration build variants (from the bottom left in android studio), if you want to use the configuration for integration buildType.
From what you describe you appear to be using a different buildType. By default it is debug. Make sure an integration Build Variant is selected and you should be good.
As it often happens, I found and answer after posting my question.
"This is not a bug, this is a feature":
https://groups.google.com/forum/m/#!topic/adt-dev/iS_lyRH8hL8
This is not really a problem, but certainly annoying.
The output you are seeing is related to the way the Android gradle plugin determines the set of classes that must be in the main dex file when multidex is enabled. For this purpose it uses ProGuard internally, but it is unrelated to your configuration.
In order to disable the logging output of this task, you can add the following to your build.gradle file:
tasks.whenTaskAdded { task ->
if (task.name.startsWith("transformClassesWithMultidexlistFor")) {
task.logging.level = LogLevel.ERROR
}
}

Google Play says my APK built with Android Studio Build->Generate Signed APK is debuggable

I get the message: You uploaded a debuggable APK. For security reasons you need to disable debugging before it can be published in Google Play. Learn more about debuggable APKs.
I generate my APK with Android Studio, Build->Generate Signed APK. I created a Keystore.
With a powerful gradle build system in android studio you can do it without even touching your code. You can also make your debug build with debuggable false to test what differences are
buildTypes {
debug {
runProguard false/true
proguardFile getDefaultProguardFile('proguard-android.txt')
debuggable false/true
}
release {
runProguard true/false
proguardFile getDefaultProguardFile('proguard-android.txt')
debuggable false/true
}
}
Power of Gradle.
Note : You wont be able to see the process in the left pane of DDMS under device info even the application running in device, if it has debuggable false in build configuration.
If you have the tag android:debuggable="true" in your application manifest, or if you don't have it in, try changing it/putting this in your application manifest tag:
android:debuggable="false"
Check DEBUG value in BuildConfig.java file in gen folder. Sometime if we are not doing clean build this value remains true.
Best is to do a clean release build.
If you're using Gradle (As you should) set the debug and release variables, then go to your build variables tab and select release flavor.
Build the project, and if you set everything up correctly, your apk should be in the build/apk folder of your project.
I was having this same problem. Anymore, android:debuggable in the manifest file is deprecated if you are using Android Studio; you shouldn't have it there. The problem in my case was that the system was incorporating debug versions of some component classes, which did not get rebuilt (as I assumed they would) when I switched from doing debug to release builds. Everything worked once I selected (from the menus) Build->Clean Project.

Installation failed with Android Studio, APK not signed

Recently change to Android Studio from Eclipse and I have also changed the JDK from java-open-jdk to jdk1.7.0_45.
Now I'm trying to run my first app and I get this message:
Installation failed since the APK was either not signed, or signed incorrectly.
If this is a Gradle-based project, then make sure the signing configuration
is specified in the Gradle build script
Edit:
When I'm running from Android Studio I get the error displayed above. When I'm running it from the command line I don't get an error (well the app is running and I get an error but nothing to do with gradle).
I got the code from here
You can check build.gradle here at google repo
UPDATE 2:
I added this code
signingConfigs {
release {
storeFile file("john.keystore")
storePassword "john"
keyAlias "johnkeystore"
keyPassword "john"
}
}
just above the buildTypes code block in the build.gradle file.
File john.keystore is on the root of my Project. I'm running gradlew assembleRelease and I'm getting a xxx-release-unsigned.apk.
If you indeed runing build with gradle you need to configure signingConfigs. Android can configure your debug signingConfig automatically. You can make release signingConfig in a next manner:
android {
signingConfigs {
release {
storeFile file('android.keystore')
storePassword "pwd"
keyAlias "alias"
keyPassword "pwd"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
Check manual on this topic here: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Signing-Configurations
If you still have issues, please update question with your build.gradle. Most likely issue is laying here. I'm using JDK 1.7 and gradle builds are working fine.
I had the same problem, i went to Build->Clean Project and re-execute the project and it worked.
I have been struggling for a while with Android Studio esp. gradle and build variants.
I have change this from the build types as defined:
debug
release
As I ran into the same problem (while developing and running tests), I went to Build -> Rebuild Project and then re-launched the emulator. That worked for me.
None of the answers worked for me, even after uninstalling app from phone, I could not deploy it. What worked was installing the app o a different device, and then when I tried to deploy it on the previous device, it miracleously worked.
If your goal is not to create a custom build for your application you might want to clean all the data about it from your test device, in case you are using emulator just wipe all the data from device. Go to -> Tools -> Android -> AVD Manager -> [Device you wanna wipe] (In actions tab) -> Wipe Data.
In case of actual device just uninstall the app and all related data.
Reason is that unsigned APK has a signature, so device sees you're trying to install something with the same package name that was generated not here.
Hope this saves you some time.
In case your device has multiple users, before installing signed APK, check if the same app is not installed for other users. If it is there remove it.
For me this was the root cause of rejecting installation of signed APK.
Just to Build -> Rebuild Project and then re-launched the emulator. That worked for me.

Android Studio ProGuard does not appear to run

I switched over from Eclipse to Android Studio in the last few days and have gotten most everything working. However, when I generate a signed APK it appears as though ProGuard is never running.
I am using the Generate Signed APK Wizard, selecting 'Run ProGuard' and specifying my proguard.cfg as the config file. The build process runs without errors and generates a functional apk, but that apk is 65% larger than the one generated by Eclipse. When I generate the apk through Android Studio's APK Wizard and do not select 'Run Proguard' the resulting apk is the same size as the one that should have had ProGuard run on it. No mapping.txt, seeds.txt, or usage.txt is generated anywhere in my project directory. I have tried adding
buildTypes {
release {
runProguard true
proguardFile file('proguard.cfg')
proguardFile getDefaultProguardFile('project-android.txt')
}
}
and variations to my build.gradle file but that has had no effect either.
This is occurring on Android Studio 0.2.0, though I was seeing the same behavior on 0.1.9. I am working on Windows 7.
Can anyone tell me what might be going on? I would be happy if I could find the logs ProGuard is supposed to generate.
Just update your build.gradle
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
Details Reference.
I hope it will helps you
Happily, I have found a solution. The issue was that before creating the signed apk, I had modified the package name in the AndroidManifest in order to overwrite a particular build in the Google Play Store. However, this change of package name had not refactored all of the corresponding "import 'package name'.R;" lines throughout the code. Today, after re-importing the project, it would no longer build because of errors attempting to import R. Once I modified all the import lines, not only did my project build properly, but exporting the signed apk properly ran ProGuard.
I'm guessing that Android Studio was somehow caching the "import R" lines and that when ProGuard was attempting to run it did not have those cached values and then crashed. Why there was no error output for me to see, I do not know.
**in new Gradle system**
BuildType.runProguard -> minifyEnabled
BuildType.zipAlign -> zipAlignEnabled
BuildType.jniDebugBuild -> jniDebuggable
BuildType.renderscriptDebug -> renderscriptDebuggable
ProductFlavor.renderscriptSupportMode -> renderscriptSupportModeEnabled
ProductFlavor.renderscriptNdkMode -> renderscriptNdkModeEnabled
or visit at
http://tools.android.com/tech-docs/new-build-system

Categories

Resources