0

I'm new to react-native and I'm keeping getting an error while trying to build with react-native-maps. Steps I made:

react-native init --version="0.57.4" <my_app_name>
cd <my_app_name>
react-native install react-native-geocoder
react-native install react-native-maps
react-native run-android

Error message:

> Task :react-native-maps:compileDebugJavaWithJavac 
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.

> Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: android.support.v4.app.ActivityCompat

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

Following instructions from @samitha-nanayakkara, I've reached this issue, I did try to delete the build directories each time and edit android/app/build.gradle like:

defaultConfig {
...
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

That give me the error message:

> Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: android.support.v4.app.ActivityCompat


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.

Also, trying Java 8 give me the same result:

defaultConfig {
...
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

Adding multiDexEnabled true to android/app/build.gradle give me another error message:

FAILURE: Build failed with an exception. 
* What went wrong: Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. > com.android.build.api.transform.TransformException: Error while generating the main dex list.

How could I solve this?

Victoralm
  • 203
  • 3
  • 12
  • https://stackoverflow.com/questions/51239400/react-native-execution-failed-for-task-apptransformdexarchivewithexternallib – Samitha Nanayakkara Nov 04 '18 at 05:28
  • Adding `multiDexEnabled true` to `android/app/build.gradle` give me another error message: `FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. > com.android.build.api.transform.TransformException: Error while generating the main dex list.` – Victoralm Nov 04 '18 at 06:37
  • 1
    I haven’t face that problem before and cannot tell you what is the reason. But dod you try this link? https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/793 – Samitha Nanayakkara Nov 04 '18 at 09:45
  • Thanks dude, adding `dependencies { implementation 'com.android.support:design:27.1.0' }` to the `android/app/build.gradle` just before `android{...}` appears to solve the problem. – Victoralm Nov 04 '18 at 15:39

0 Answers0