sbugert / react-native-admob

A react-native component for Google AdMob banners
BSD 2-Clause "Simplified" License
1.13k stars 531 forks source link

Unable to build after installing package #488

Closed lewatt23 closed 3 years ago

lewatt23 commented 4 years ago

Hello am getting the following error after i installing the package

error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually: 
  - react-native-admob (to unlink run: "react-native unlink react-native-admob")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

Since i got the error, my application is unable to build, i tried to unlink but here what i get when i try that

info Unlinking "react-native-admob" iOS dependency error Something went wrong while unlinking. Reason Cannot read property 'find' of undefined. Run CLI with --verbose flag for more details. TypeError: Cannot read property 'find' of undefined

please can someone help me? it's been a day now that am having this problem

arochedy commented 4 years ago

I got the same problem with v1.

A installed the V2 (in beta) and now it works

lewatt23 commented 4 years ago

@arochedy hello please can you tell me how you got it working ? i mean i install the beta but i can't even build the application keeps showing the following errors


> Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings
234 actionable tasks: 218 executed, 16 up-to-date
Note: /home/stanly/Desktop/kawlo/node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/stanly/Desktop/kawlo/node_modules/react-native-fs/android/src/main/java/com/rnfs/RNFSManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/stanly/Desktop/kawlo/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /home/stanly/Desktop/kawlo/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/stanly/Desktop/kawlo/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /home/stanly/Desktop/kawlo/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/TSpanView.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/stanly/Desktop/kawlo/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/stanly/Desktop/kawlo/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
adb server version (39) doesn't match this client (41); killing...
* daemon started successfully
Note: /home/stanly/Desktop/kawlo/node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlobUtils.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
D8: Cannot fit requested classes in a single dex file (# methods: 75542 > 65536)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
  The number of method references in a .dex file cannot exceed 64K.
  Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

* Try:
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.

* Get more help at https://help.gradle.org

BUILD FAILED in 22s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
Note: /home/stanly/Desktop/kawlo/node_modules/@react-native-community/async-storage/android/src/main/java/com/reactnativecommunity/asyncstorage/AsyncStorageModule.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/stanly/Desktop/kawlo/node_modules/react-native-fs/android/src/main/java/com/rnfs/RNFSManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/stanly/Desktop/kawlo/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/react/RNGestureHandlerButtonViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /home/stanly/Desktop/kawlo/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/stanly/Desktop/kawlo/node_modules/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: /home/stanly/Desktop/kawlo/node_modules/react-native-svg/android/src/main/java/com/horcrux/svg/TSpanView.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/stanly/Desktop/kawlo/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/stanly/Desktop/kawlo/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
adb server version (39) doesn't match this client (41); killing...
* daemon started successfully
Note: /home/stanly/Desktop/kawlo/node_modules/rn-fetch-blob/android/src/main/java/com/RNFetchBlob/RNFetchBlobUtils.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
D8: Cannot fit requested classes in a single dex file (# methods: 75542 > 65536)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
  The number of method references in a .dex file cannot exceed 64K.
  Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

* Try:
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.

* Get more help at https://help.gradle.org

BUILD FAILED in 22s

    at checkExecSyncError (child_process.js:629:11)
    at execFileSync (child_process.js:647:13)
    at runOnAllDevices (/home/stanly/Desktop/kawlo/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
    at buildAndRun (/home/stanly/Desktop/kawlo/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
    at then.result (/home/stanly/Desktop/kawlo/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)
    at process._tickCallback (internal/process/next_tick.js:68:7)
laleet-avaiya commented 4 years ago

app crashed after installing.

yarn add react-native-admob@next react-native link

lewatt23 commented 4 years ago

@lmavaiya having the same error


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: 
  The number of method references in a .dex file cannot exceed 64K.
  Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html

* Try:
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.
arochedy commented 4 years ago

I got a problem like this.

I try a lot of things but the only thing which work was to support Android version 21 (android 5.0) which support multidex by default.

If you want to know more :

https://developer.android.com/studio/build/multidex

lewatt23 commented 4 years ago

@arochedy Thanks for the respond, the problem is that i live in a country where 4.4 is highly used, can't give up the support please can you suggest me another package or solution ?

arochedy commented 4 years ago

Ok. If you read the doc they explain you how to use multidex in Android before version 5.0

Good luck

El sáb., 14 dic. 2019 11:35, lewatt23 notifications@github.com escribió:

@arochedy https://github.com/arochedy Thanks for the respond, the problem is that i live in a country where 4.4 is highly used, can't give up the support please can you suggest me another package or solution ?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sbugert/react-native-admob/issues/488?email_source=notifications&email_token=AARIDZQPCR56B2L22U2OTQTQYSZFTA5CNFSM4JTRZ432YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG37VLI#issuecomment-565705389, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARIDZTGYF64HMAPQH3LVV3QYSZFTANCNFSM4JTRZ43Q .

t08-apporio commented 3 years ago

hi @lewatt23. I ran into the exact same issue. Were you able to resolve the issue?

lewatt23 commented 3 years ago

hello @t08-apporio all you need to do is enable multidex on android rn [https://rnfirebase.io/enabling-multidex](https://rnfirebase.io/enabling-multidex)

t08-apporio commented 3 years ago

hi @lewatt23. Fixed it without multidex. The gradle and sdk versions were incompatible. Thanks for your input!