Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Unoptimized APK #25166

Closed
tiennguyen9988 opened this issue Jun 6, 2019 · 19 comments
Closed

Unoptimized APK #25166

tiennguyen9988 opened this issue Jun 6, 2019 · 19 comments
Labels
Bug Resolution: Locked This issue was locked by the bot.

Comments

@tiennguyen9988
Copy link

React Native version: 0.57.1

Steps To Reproduce

  1. gradlew assembleRelease

Describe what you expected to happen:
I had issue with android, they alert: my app is "Unoptimized APK" and not accept for my app although they still accept prev version my app.

@hosseintoussi
Copy link

We have the same problem.

@suresh-jbt
Copy link

Yes, We are on the same boat 🔢

@eai301
Copy link

eai301 commented Jun 11, 2019

Google Play is generating and optimizing APKs from your Android App Bundle. This may take a few minutes, depending on the size of your app bundle.

did you try to upload .aab file!?

@raiedahmed
Copy link

how create .aab react natice v. expo

@eai301
Copy link

eai301 commented Jun 13, 2019

gradlew bundleRelease

@nainishmodi
Copy link

nainishmodi commented Jun 13, 2019

I m also facing same issue..

I have upgraded RN 0.55.4 => 0.59.9

I have also set

def enableSeparateBuildPerCPUArchitecture = true

def enableProguardInReleaseBuilds = true

splits {
       abi {
           reset()
           enable enableSeparateBuildPerCPUArchitecture
           universalApk false  // If true, also generate a universal APK
           include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
       }
   }
buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            shrinkResources true
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
            signingConfig signingConfigs.release
        }
    }

Here are some snips of my configurations of my project. Any help would be greatly appreciated.

2
3
p
1

@atha-github
Copy link

I am experiencing the same issue, I am using
"expo": "^33.0.0",
"expo-asset": "^5.0.1",
"expo-constants": "^5.0.1",
"expo-file-system": "^5.0.1",
"expo-font": "^5.0.1",
"react": "16.8.3",
"react-dom": "^16.8.6",
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
"react-native-elements": "^1.1.0",
"react-navigation": "^3.11.0",

After expo build:android I got a apk of 19MB, But unable to review and publish in google playstore.
531e10d5fe8ca6e7e4c5538912bd90490f3eba9a_2_690x163
17380331cb142d4d0cf0774b865f61870962f29f_2_690x302

@kelset
Copy link
Contributor

kelset commented Jun 18, 2019

Hello there 👋 this issue doesn't have a repro (which means, a react-native init-ed project with the minimal changes that leads to creating the same issue you are reporting). Unfortunately, I have no way of helping you in a meaningful way – there is no easy way for me to recreate the situation and check that the issue reported is still there when changing the code.

Can anyone look a bit deeper in what causes this error? Maybe in the google play store development portal there may be a doc explaining it?

Because of this, we are going to close this issue - but if a repro is shared, we are happy to reopen it 🤗

@kelset kelset closed this as completed Jun 18, 2019
@ReactDevs007
Copy link

I found one solution.
Please reply me if someone interested in this.

@lukefanning
Copy link

@ReactAndrey Could you share the solution to this?

@nainishmodi
Copy link

nainishmodi commented Jul 6, 2019 via email

@pragneshpj
Copy link

I found one solution.
Please reply me if someone interested in this.
@ReactAndrey
Could you share the solution to this?

@NazarK
Copy link

NazarK commented Jul 11, 2019

You should just build and upload aab (Android App Bundle) file instead of apk .

cd android
./gradlew bundleRelease
cd ..

aab file will be placed in"/android/app/build/outputs/bundle/release/"

@jwheat
Copy link

jwheat commented Jul 15, 2019

As a follow up to @eai301 and @NazarK (thank you BTW), you MUST opt-in to the Google Managed App Signing, or else it will not accept your .aab file. I had opted-out and couldn't find a way to change my mind, had to delete the app from my dashboard and start over, which was fine since I was just starting.

This whole thing started because my .apk was 'too large' (have a lot of images). Ironically, my .aab file was exactly 30 bytes smaller

31391694 Jul 14 21:09 app-release.apk
31319664 Jul 15 06:32 app.aab

@nainishmodi
Copy link

nainishmodi commented Jul 15, 2019

I just created the .aab file using below command
cd android then gradlew bundleRelease

You will find you the .aab file inside android/app/build/outputs/bundle/release
and then I uploaded it in my Google Console account and then that warning disappears so my suggestion is to all who are struggling with this error kindly go with this.

@anastely
Copy link

anastely commented Aug 1, 2019

I want to reduce my APK Size
I followed these https://facebook.github.io/react-native/docs/signed-apk-android
and run ./gradlew bundleRelease instead of assembleRelease
But I Got Error

Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
Job failed,

So how can I solve it, I'm Google it but the issue is still!
But without Enable Proguard it's work very well and I got (Aab & .Apk ) SO How To Solve it!

I think the issue with this file but I don't know how to configure that!

proguard-rules.pro


# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

@ReactDevs007
Copy link

@ReactAndrey Could you share the solution to this?

Hi sorry for late reply. I am busy for some projects.
You can simple do such like this.
Open your app in android studio.
Maybe you have to upgrade android studio version.
And then Build/Generated Signed Bundle on Apk and then you can choose Android App Bundle.
After create aab file you can upload this.

@Johnny-lou
Copy link

@hosseintoussi problem solved?

@Johnny-lou
Copy link

@ReactDevs007 I have the same problem, what should I do?

@facebook facebook locked as resolved and limited conversation to collaborators Jun 18, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jun 18, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Bug Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests