apache / cordova-android

Apache Cordova Android
https://cordova.apache.org/
Apache License 2.0
3.59k stars 1.52k forks source link

New BETA Version of Google Play Console show this warning: [This App Bundle contains Java/Kotlin code] #1008

Closed mosabab closed 1 year ago

mosabab commented 3 years ago

Bug Report

Problem

What is expected to happen?

Google Play Console (New BETA Version) should not show warnings when you try to upload the app to Play Store.

What does actually happen?

When you try to upload the bundle for release using new Google Play Console (New BETA Version), the following warning message appear:

This App Bundle contains Java/Kotlin code, which might be obfuscated. We recommend you upload a deobfuscation file to make your crashes and ANRs easier to analyze and debug. Learn More

The app uploaded successfully and released well, but the only issue is the warning message.

Information

I try with preference AndroidXEnabled = false and try with true I try with preference GradlePluginKotlinEnabled = true and try with false

Using new Google Play Console (New BETA Version)

Command or Code

Environment, Platform, Device

Version information

Cordova-cli 9.0.0 Cordova-android 9.0.0 Android Studio v4.0 Gradle 6.5 Node.js 12.8.2 Java JDK 8

I am using only cordova plugins (using the latest version for each plugin): cordova-plugin-battery-status cordova-plugin-device cordova-plugin-dialogs cordova-plugin-geolocation cordova-plugin-inappbrowser cordova-plugin-network-information cordova-plugin-screen-orientation cordova-plugin-splashscreen cordova-plugin-statusbar cordova-plugin-vibration cordova-plugin-whitelist

Checklist

jacobwardio commented 3 years ago

Getting the same issue since using the 'new' Google Play Console. @mosabab did you find a resolution to this?

mosabab commented 3 years ago

Getting the same issue since using the 'new' Google Play Console. @mosabab did you find a resolution to this?

Hello, I didnt find any solution until now.

The app uploaded well and released to store, but the warning message appear.

jeebius commented 3 years ago

Getting this issue too, went back to classic mode for now

MatthewAlner commented 3 years ago
CleanShot 2020-08-20 at 22 53 30@2x

same warning and another, the links in the screenshot are here and here

┗ ❯ ionic info

Ionic:

   Ionic CLI                     : 6.11.0 (/Users/matt/.config/yarn/global/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.0.0
   @angular-devkit/build-angular : 0.901.12
   @angular-devkit/schematics    : 9.1.12
   @angular/cli                  : 9.1.12
   @ionic/angular-toolkit        : 2.1.2

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : android 9.0.0, android_old 9.0.0
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 8 other plugins)

Utility:

   cordova-res (update available: 0.15.1) : 0.9.0
   native-run (update available: 1.0.0)   : 0.3.0
Mitdd9707 commented 3 years ago

same issue..! @mosabab did you find a resolution to this?

jeebius commented 3 years ago

Hey everyone, I found changing minimum target to api 29 fixed this for me

breautek commented 3 years ago

Hey everyone, I found changing minimum target to api 29 fixed this for me

Changing the min target api to 29 would essentially limit the app to only devices capable of running the latest android OS.

madhaviKumari commented 3 years ago

I removed this warning by uploading ReTrace mapping file. It can be generated by enabling minify as follows.

 buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

After building apk/app bundle you can find /app/build/outputs/mapping/release/mapping.txt file . New console will allow you to upload mapping.txt along with your apk or bundle. You can find this option from App bundles and APKs menus.

breautek commented 3 years ago

I removed this warning by uploading ReTrace mapping file. It can be generated by enabling minify as follows.

 buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

After building apk/app bundle you can find /app/build/outputs/mapping/release/mapping.txt file . New console will allow you to upload mapping.txt along with your apk or bundle. You can find this option from App bundles and APKs menus.

I briefly looked at this issue before and I believe this is the proper fix. I'd support a PR that adds this to the cordova-android project build.gradle file. I believe it should be added to https://github.com/apache/cordova-android/blob/master/bin/templates/project/build.gradle ?

madhaviKumari commented 3 years ago

I removed this warning by uploading ReTrace mapping file. It can be generated by enabling minify as follows.

 buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

After building apk/app bundle you can find /app/build/outputs/mapping/release/mapping.txt file . New console will allow you to upload mapping.txt along with your apk or bundle. You can find this option from App bundles and APKs menus.

I briefly looked at this issue before and I believe this is the proper fix. I'd support a PR that adds this to the cordova-android project build.gradle file. I believe it should be added to https://github.com/apache/cordova-android/blob/master/bin/templates/project/build.gradle ?

No It should be added to app/build.gradle : https://github.com/apache/cordova-android/blob/master/bin/templates/project/app/build.gradle.

breautek commented 3 years ago

Right, I forgot about the app/build.gradle

Would you like to make a PR so that credit remains to you?

mosabab commented 3 years ago

Right, I forgot about the app/build.gradle

Would you like to make a PR so that credit remains to you?

Are you attend to make pull request to solve this issue ?

mosabab commented 3 years ago

I removed this warning by uploading ReTrace mapping file. It can be generated by enabling minify as follows.

 buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

After building apk/app bundle you can find /app/build/outputs/mapping/release/mapping.txt file . New console will allow you to upload mapping.txt along with your apk or bundle. You can find this option from App bundles and APKs menus.

Thanks for your solution, just to know: You don't need to upload mapping.txt file, it is already contains with bundle file (.aab). So when you try to Upload the aab file to release section (production) just only add .aab file, and the file mapping.txt will included.

To check this please upload the aab file and then go to: Go to Release/"App bundle explorer" Select the right artifact in the top right corner Open Downloads tab Scroll to the Assests section Next to the "ReTrace mapping file" you will see the mapping.txt included.

Regards

breautek commented 3 years ago

You don't need to upload mapping.txt file, it is already contains with bundle file (.aab). So when you try to Upload the aab file to release section (production) just only add .aab file, and the file mapping.txt will included.

But you do need to upload the mapping.text file if you're uploading an apk file correct? I feel like this should be documented somewhere in the android documentation although not sure where would be the best place exactly. Perhaps it can be a subsection of a Signing an App...?

mosabab commented 3 years ago

You don't need to upload mapping.txt file, it is already contains with bundle file (.aab). So when you try to Upload the aab file to release section (production) just only add .aab file, and the file mapping.txt will included.

But you do need to upload the mapping.text file if you're uploading an apk file correct? I feel like this should be documented somewhere in the android documentation although not sure where would be the best place exactly. Perhaps it can be a subsection of a Signing an App...?

Yes you are right. Sorry I forget to mention apk that need to include with mapping.txt.

Yes it is good idea to document this.

akadebnath commented 3 years ago

Here what happened: I added minify lines. Generated apk file. Copid it to my phone. Installed it directly from release apk. Then trying to open the app, but the app crashes at open.

mosabab commented 3 years ago

Here what happened: I added minify lines. Generated apk file. Copid it to my phone. Installed it directly from release apk. Then trying to open the app, but the app crashes at open.

this exactly what happened.

The app crashes when start.

I don't know why this happend!

mosabab commented 3 years ago

@breautek

Do you remember when i close the pull for this ??

Because the app go crashes when opened.

Do you have any idea ?

asalhallak commented 3 years ago

+1

breautek commented 3 years ago

@breautek

Do you remember when i close the pull for this ??

Because the app go crashes when opened.

Do you have any idea ?

This is what you told me:

https://github.com/apache/cordova-android/pull/1061#issuecomment-687758391

juanferrgiraldo commented 3 years ago

I removed this warning by uploading ReTrace mapping file. It can be generated by enabling minify as follows.

 buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

After building apk/app bundle you can find /app/build/outputs/mapping/release/mapping.txt file . New console will allow you to upload mapping.txt along with your apk or bundle. You can find this option from App bundles and APKs menus.

Thanks for your solution, just to know: You don't need to upload mapping.txt file, it is already contains with bundle file (.aab). So when you try to Upload the aab file to release section (production) just only add .aab file, and the file mapping.txt will included.

To check this please upload the aab file and then go to: Go to Release/"App bundle explorer" Select the right artifact in the top right corner Open Downloads tab Scroll to the Assests section Next to the "ReTrace mapping file" you will see the mapping.txt included.

Regards

Thanks for your help but I'm not sure if mapping.txt file is already contained in bundle file because if I look into my "Retrace mapping file" in Assests section it is empty.

image

anmolghosh commented 3 years ago

Any update on fixing this?

Gaurav-MobDev commented 3 years ago

minifyEnabled = true gives Network error whenever I hit any API. What rule should I add to proguard to fix it

elsunhoty commented 3 years ago

Here what happened: I added minify lines. Generated apk file. Copid it to my phone. Installed it directly from release apk. Then trying to open the app, but the app crashes at open.

this exactly what happened.

The app crashes when start.

I don't know why this happend!

Still Same Thing With Me

any Updates About this Issue

mosabab commented 3 years ago

Any update for a PR to fix this issue ?

khanajmal1 commented 3 years ago

if minifyEnabled = true gives Network error whenever API's. then simply try to minifyEnabled=false Spam link removed by PMC member

HarelM commented 2 years ago

I'm not sure I fully understand this thread. Does anyone has fixes to these warnings? Is there a simple way to solve them?

kzimny commented 2 years ago

My app crashes when open an internal test release from google play with the fix minifyEnabled = true in app/build.gradle proposed by @mosabab. The mapping.txt file is automatically added into bundle. It can be uploaded to google play without any warnings, but it it crashes every time. Question: what can happen in production when I would publish the app without the fix, with warning about java/kotlin code? I installed such internal release with this warning on my android device. The app works without crashing. Is the warning important for production releases? Does someone published an aab bundle to production with this warning message? Please help!

HarelM commented 2 years ago

I'm publishing with this warning to production, it works without issues, I just would like to resolve the warnings...

breautek commented 2 years ago

Does someone published an aab bundle to production with this warning message? Please help!

You are able to publish with this warning. It is just a warning after all.

The reason for the warning is that in the event of an app crash, Android might not be able to give you human readable stack traces helpful for debugging without these mappings.

I'm not sure how to properly configure the android project to address this warning however.

erisu commented 2 years ago

If I remember correctly, minifyEnabled will cause issues with Cordova.

https://issues.apache.org/jira/browse/CB-9269?focusedCommentId=15154940&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-15154940

Since Cordova uses Reflection all over the place, this is a good way to blow up Cordova without a proguard-rules.pro file.

If you want to enable minification, you would need to figure out the proguard-rules.pro configurations.

Here is an SO thread where people talked about configurations they either used or suggested.

https://stackoverflow.com/questions/37994892/cordova-android-5-1-1-apk-obfuscation-with-proguard-confusion

I am not sure if this is something we should attempt to handle or invest the time in at this moment.

You could try and play around with the proguard rules to see if you can get the build to pass with minification enabled but make sure to try with plugins as well. Since each plugin developer does things differently there is always a chance they used reflection within their plugins that would require rule configurations.

kzimny commented 2 years ago

Thank you for the information and the useful links. Yes, I'm using cordova plugins like: cordova-plugin-inappbrowser, cordova-plugin-device, cordova-plugin-statusbar, cordova-plugin-splashscreen, cordova-plugin-network-information. Maybe something is wrong with the plugins... In the meantime I published my application to production with this warning message. Everything works fine. However, I would like to play around with the proguard-rules.pro. Do you know where to add the proguard-android-optimize.txt file in cordova project?

breautek commented 1 year ago

Closing this issue as won't fix.

See https://github.com/apache/cordova-android/issues/1008#issuecomment-885780724 for details.