Anuj Sharma
Anuj Sharma

Reputation: 457

How to create react-native apk in Expo?

I want to create APK file of my project app. I am working on this expo documentation But it failed everytime what is wrong with thisenter image description here.

it gives this error cannot able to make a build.

 Copying resources from program jar [/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/mergeJavaRes/release/0.jar] (filtered)
/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/proguard/release/0.jar: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.e.ej$a.a(long, byte)`
/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/proguard/release/0.jar: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.o.gu$a.a(long, byte)`
> Task :app:transformClassesWithDexBuilderForRelease
/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/proguard/release/0.jar: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.q.gc$a.a(long, byte)`
/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/proguard/release/0.jar: D8: Type `org.conscrypt.Conscrypt` was not found, it is required for default or static interface methods desugaring of `java.security.Provider okhttp3.internal.platform.ConscryptPlatform.getProvider()`
/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/proguard/release/0.jar: D8: Type `io.branch.referral.Branch` was not found, it is required for default or static interface methods desugaring of `void host.exp.exponent.b.a.a(android.app.Application)`
/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/proguard/release/0.jar: D8: Type `org.slf4j.impl.StaticLoggerBinder` was not found, it is required for default or static interface methods desugaring of `void org.b.c.c()`
/app/turtle/workingdir/android/sdk35/android-shell-app/app/build/intermediates/transforms/proguard/release/0.jar: D8: Type `libcore.io.Memory` was not found, it is required for default or static interface methods desugaring of `void com.google.android.gms.internal.ads.cnv$b.a(long, byte)`
> Task :app:transformDexArchiveWithDexMergerForRelease
> Task :app:mergeReleaseJniLibFolders
> Task :app:transformNativeLibsWithMergeJniLibsForRelease
> Task :app:packageRelease FAILED
1605 actionable tasks: 1605 executed
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:packageRelease'.
[stderr] > com.android.ide.common.signing.KeytoolException: Failed to read key Techie@123 from store "/tmp/turtle/keystore-61d7d6e3-26f6-4954-b4a3-97305b4bfd3a.jks": No key with alias 'Techie@123' found in keystore /tmp/turtle/keystore-61d7d6e3-26f6-4954-b4a3-97305b4bfd3a.jks
[stderr] * Try:
[stderr] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 6m 44s
Error: ./gradlew exited with non-zero code: 1
    at ChildProcess.completionListener (/app/turtle/node_modules/@expo/xdl/node_modules/@expo/spawn-async/build/spawnAsync.js:52:23)
    at Object.onceWrapper (events.js:317:30)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:915:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
    ...
    at spawnAsync (/app/turtle/node_modules/@expo/xdl/node_modules/@expo/spawn-async/build/spawnAsync.js:17:21)
    at spawnAsyncThrowError (/app/turtle/node_modules/@expo/xdl/build/detach/ExponentTools.js:235:45)
    at buildShellAppAsync (/app/turtle/node_modules/@expo/xdl/build/detach/AndroidShellApp.js:881:11)
    at <anonymous>

Upvotes: 2

Views: 5617

Answers (5)

Vincent Gerris
Vincent Gerris

Reputation: 7528

You don't need eas, you can use expo, but you will have to fix some things:

 npx expo prebuild 

This will create and android and an ios directory

npx expo run:android 
› Building app...
Starting a Gradle Daemon (subsequent builds will be faster)
Configuration on demand is an incubating feature.

For ios:

npx expo run:ios

For me these defaults never worked, you will have to change gradle setting for Android, like JDK, NDK etc.

For ios there are some tricks needed in the Podfile to make the Cocoapods work.

The issues that occur are pretty well documented and fixable, and I was able to get a native build for Android and iOS to work.

Also install the expo-dev-client package :https://docs.expo.dev/versions/latest/sdk/dev-client/

And read how to do local dev apk or production version, which requires a keystore setup etc.

Upvotes: 0

Abdul Muqeet
Abdul Muqeet

Reputation: 11

  1. Make sure You have package name and versioncode inside the android like ( android: { "package": "com.envogram.envogram", "versionCode": 1 } ) in "app.json" file.
  2. Run expo start
  3. Open another command prompt and run expo build:android.
  4. Now wait for completing the bundle.
  5. Check Status and queue of the app by generated link.
  6. In the end Download the apk file and Install in mobile.

Upvotes: 1

Parvej Mallick
Parvej Mallick

Reputation: 465

In a terminal/cmd prompt let the expo server running by expo start and in another terminal/cmd prompt run expo build:android if did't work try to build by clearing the credentials run

expo build:android -c

Upvotes: 2

savan patel
savan patel

Reputation: 254

if you want to generate apk eject the CRNA with npm run eject command. Then you will get android and ios folders suppurate in mac and you will get an only android folder in windows. and follow the instruction which is in a given link below

"https://facebook.github.io/react-native/docs/signed-apk-android.html"

Upvotes: -1

Taym95
Taym95

Reputation: 2510

Try removing the .expo directory from the project root.

Upvotes: 1

Related Questions