Comments (44)
i found the way to solve this problem.
just remove both 'build' folder in /android and /android/app
and build again with 'react-native run-android'
from react-native-gcm-android.
Try running ./gradlew app:dependencies
in android
directory in terminal
from react-native-gcm-android.
I just had to set multiDexEnabled = true
. I don't really understand the implications, but people seem to discourage it. But it hasn't caused me any problems.
from react-native-gcm-android.
remove android folder run
react-native upgrade
then
react-native run-android
from react-native-gcm-android.
In app/build.gradle
add
defaultConfig{
...
multiDexEnabled true //add this
}
from react-native-gcm-android.
Work to me
react-native init projectwebrtc
cd projectwebrtc
npm i -s react-native-webrtc
react-native link react-native-webrtc
and in android/app/build.gradle add inside android section:
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
from react-native-gcm-android.
If your minSdkVersion is lower then 21 you need to add multiDexEnabled = true
on app/build.gradle
reference: https://developer.android.com/studio/build/multidex
from react-native-gcm-android.
I'm using react-native-maps and my issue was Execution failed for task ':app:mergeDexDebug'.
I solved by editing the app/build.gradle:
android {
defaultConfig {
// ...
multiDexEnabled true
}
// ...
}
from react-native-gcm-android.
Below lines works for me,
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
from react-native-gcm-android.
Refer this
android {
defaultConfig {
...
minSdkVersion 21
targetSdkVersion 26
multiDexEnabled true <---- Add this
}
...
}
from react-native-gcm-android.
I got the same error after using react-native-firebase
SDK but after adding multiDexEnabled true
inside android/app/build.gradle
it's work for me Thanks @lynndylanhurley
from react-native-gcm-android.
@notlose Solution work for me! ( I am using React Native 0.51 )
after remove both /android/build
and /android/app/build
and re-run
cd android && ./gradlew assembleRelease
Success!
from react-native-gcm-android.
Had the same issue and the solution that worked for me was to add this to my build.gradle
:
dexOptions { jumboMode true }
I also added dex.force.jumbo=true
to my gradle.properties
just to be sure. Seems like that did the magic.
from react-native-gcm-android.
In my case gradle was not in the environment variables. Check in terminal for the command gradle. If not recognized first you have to find the folder of gradle in configuration> settings> build of the android studio. The bin is added to the environment variables. Check again the gradle word in terminal later it runs ./gradlew in unix like systems from the terminal or .\ gradlew in the powershell of windows
from react-native-gcm-android.
Neither solution worked for me. I even removed the folder node_modules and did npm install
again.
The full error:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzlv;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
:app:transformClassesWithDexForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.transform.api.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/bin/java'' finished with non-zero exit value 2
from react-native-gcm-android.
i found the way to solve this problem.
just remove both 'build' folder in /android and /android/app
and build again with 'react-native run-android'
@notlose thanks you! I struggled with this issue for two hours! This fixed it!
from react-native-gcm-android.
Error:Execution failed for task ':app:transformClassesWithDexBuilderForDebug'.
com.android.build.api.transform.TransformException: java.lang.IllegalStateException: Dex archives: setting .DEX extension only for .CLASS files
this error in my app
please help my
from react-native-gcm-android.
there's no need to remove "build" folders manually, just run "gradlew clean" command in android folder.
from react-native-gcm-android.
@sturmenta , it's in android/app/build.gradle
from react-native-gcm-android.
Thanks @Darkensses this worked. I wonder why the tooling does not enable this by default. But I guess it would prevent the app from running on very old Android devices?
With this setting it runs on my baseline Android 5 device without problems.
from react-native-gcm-android.
I just had to set
multiDexEnabled = true
. I don't really understand the implications, but people seem to discourage it. But it hasn't caused me any problems.
Thanks alot this worked! <3
from react-native-gcm-android.
i got the same error
from react-native-gcm-android.
rn 0.18.0
from react-native-gcm-android.
Good!
from react-native-gcm-android.
@nbastoWM
Can you share your project android/build.gradle
and android/app/build.gradle
from react-native-gcm-android.
android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
classpath 'com.google.gms:google-services:1.4.0-beta3' // <- Add this line
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
}
}
android/app/build.gradle
apply plugin: "com.android.application"
apply plugin: 'com.google.gms.google-services' // <- Add this line
apply from: "react.gradle"
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.wmmycityapp"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled false // Set this to true to enable Proguard
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
}
dependencies {
compile project(':react-native-google-analytics-bridge')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:0.17.+"
compile project(':reactnativemapboxgl')
compile project(':react-native-image-picker')
compile project(':react-native-icons')
compile project(':RNDeviceInfo')
compile project(':react-native-contacts')
compile project(':reactdate')
compile "com.google.android.gms:play-services-gcm:8.1.0" // <- Add this line
compile project(':RNGcmAndroid') // <- Add this line
compile project(':react-native-system-notification') // <- Add this line
}
from react-native-gcm-android.
I got it running by changing to:
compile "com.google.android.gms:play-services-gcm:8.3.0"
and
classpath 'com.google.gms:google-services:1.5.0-beta3'
from react-native-gcm-android.
Good! This solution will help many people that encounter this issue.
from react-native-gcm-android.
Yup ! I had faced the same issue, @nbastoWM solution worked pretty well. Can I update the Readme, if there is no compatible problem with play-services-gcm:8.3.0 and google-services:1.5.0-beta3 ?
from react-native-gcm-android.
@vikassy Please do it, thanks.
from react-native-gcm-android.
@nbastoWM - I made those changes, but I'm still only able to build the app with multiDexEnabled = true
. I tried deleting both of my build folders and updating those two packages, but nothing seems to work except multiDexEnabled = true
. Is there anything else that you may have done to get past this issue that you're leaving out?
from react-native-gcm-android.
@lynndylanhurley I'm not sure but you may try to delete android/app/src/main/assets/index.android.bundle
. Let me know if it doesn't work.
from react-native-gcm-android.
I'm having the same issue. @lynndylanhurley Did you find any solutions?
@oney I tried to run the project without compile "com.google.android.gms:play-services-gcm:8.3.0"
and classpath 'com.google.gms:google-services:1.5.0-beta3'
but I still get the same error.
Do you think this has to do with the GCM libraries or with your code?
from react-native-gcm-android.
Try adding this in your android/app/build.gradle
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.getRequested().getGroup() == 'com.google.android.gms') {
details.useVersion('9.8.0')
}
}
}
from react-native-gcm-android.
If java 8 or above is used then the problem is the libraries we use are incompatible with java 8. So to solve this add these two lines to build.gradle of your app and all sub modules if any. (Android studio clearly show how to do this in error message)
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
from react-native-gcm-android.
@MaheshNandam In what file did you add those lines?
from react-native-gcm-android.
This worked for me after 4 hours of trying, by adding this to the module dependencies :
dependencies {
configurations {
all*.exclude group: 'com.android.support', module: 'support-v13'
}
....
}
I hope this helps ๐
from react-native-gcm-android.
If you are running on Terminal, check if the java version you are using is 1.8.
$ java -version
depending on gradle version you might have issues with java 1.8+
So, install the 1.8 version and change the JAVA_PATH
to:
export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"
Make sure it's on your PATH
as well
from react-native-gcm-android.
Please tell me where I need to enter the command 'react-native run-android' ?
from react-native-gcm-android.
i found the way to solve this problem.
just remove both 'build' folder in /android and /android/app
and build again with 'react-native run-android'
Very good!
from react-native-gcm-android.
If your minSdkVersion is lower then 21 you need to add
multiDexEnabled = true
onapp/build.gradle
reference: https://developer.android.com/studio/build/multidex
help full for me
from react-native-gcm-android.
Deleting build folders didnot solve my issue
I need to delete some hidden folders too. Change settings to view hidden folders ( cmd +shift + . in mac)
Delete build, .gradlew, .idea, files with .iml in android folder
Delete build folder in android/app
Now go back and run react-native run-android
Good luck :)
from react-native-gcm-android.
Hey everyone! I am getting this error when generating release apk, in debug works fine
> Task :app:mergeDexRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDexRelease'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> java.lang.OutOfMemoryError (no error message)
from react-native-gcm-android.
Just delete android/.gradle
and 'android/app/build'.
Reasons for the issue.
- Renaming the app folder.
- Moving the project directory.
- File System rewired
from react-native-gcm-android.
Related Issues (20)
- npm version is newer than github version HOT 1
- App crashes when closed while receiving notification HOT 5
- npm WARN [email protected] requires a peer of react-native-system-notification@^0.1.2 but none was installed. HOT 7
- Error: 'GcmAndroid.launchNotification internal', undefined HOT 1
- Handling AndroidManifest.xml with buildtypes and applicationIdSuffix HOT 1
- com.facebook.react.bridge.UnexpectedNativeTypeException: TypeError: expected dynamic type `int64', but had type `double'
- issue with implementaion HOT 2
- App does not receive messages after reboot on Android 5.0 HOT 1
- App crashes while in background
- Cant get token HOT 1
- RN 0.29 needs Activity instance? HOT 3
- Emitter
- SysNotificationClick as Listener doesnยดt work for me (Android)
- Oney: Are you still interested in keeping this library up to date? I can help HOT 1
- Error :app:transformClassesWithJarMeringForDebug HOT 1
- google services
- No static method builder() Lcom/facebook/react/ReactInstanceManager$Builder; HOT 1
- I'm getting this error when I run my app. No error shows up while building though. Please help me
- react-native-fcm
- ar
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-gcm-android.