Reputation: 53
Here is a snippet of my build.gradle in the app level:
android {
compileSdkVersion 23
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.miniProject"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
vectorDrawables.useSupportLibrary = true
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false
include "armeabi-v7a", "x86"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
def versionCodes = ["armeabi-v7a":1, "x86":2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) {
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
and its dependencies:
dependencies {
compile project(':react-native-android-location-services-dialog-box')
compile project(':react-native-image-crop-picker')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
}
I already have added google() on my project level build.gradle. I previously installed google play services in the SDK tools and added
compile "com.google.android.gms:play-services:11.6.0"
to the dependencies. I uninstalled google play services and remove the play-services in dependencies, to restore it to its working copy, but now it prompts the error 'unable to merge dex'. What should I do?
Upvotes: 0
Views: 240
Reputation: 696
the problem happening due to Over 64K Methods (https://developer.android.com/studio/build/multidex.html)
dependencies {
compile project(':react-native-android-location-services-dialog-box')
compile project(':react-native-image-crop-picker')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile 'com.android.support:multidex:1.0.0' ///add this line
compile "com.facebook.react:react-native:+" // From node_modules
}
=======
defaultConfig {
applicationId "com.miniProject"
minSdkVersion 16
targetSdkVersion 23
multiDexEnabled true ///add this line
versionCode 1
versionName "1.0"
ndk {
abiFilters "armeabi-v7a", "x86"
}
vectorDrawables.useSupportLibrary = true
}
Upvotes: 1