Unity About reducing the number of methods (Android)
When implementing many library files with Android's RewardVideo etc., the following error may occur and Build
may not be able to be done.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
1
2
3
4
5
2
3
4
5
In this case, please consider one of the following methods.
Removing unneeded libraries
Delete the setting that calls the add network not calling.
If you are using When installing all the ad networks collectively
as described in RewardVideo advertisement (Android package build procedure), please refer to each installation procedure of only the ad network to be used Please do it.
Implementation of Multidex
There is a way to enable Multidex support so that it can handle over 65,000 methods.
- Open
plugins>Android>mainTemplate
and add the following settings.
buildscript {
maven {
url 'https://maven.google.com'
}
}
dependencies {
compile 'com.android.support:multidex:1.0.3'
}
android {
defaultConfig {
multiDexEnabled true
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
- Open
plugins>Android>mainTemplate
and removeuseProguard **PROGUARD_DEBUG**
from the settings as follows.
buildTypes {
debug {
minifyEnabled **MINIFY_DEBUG**
useProguard **PROGUARD_DEBUG**
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
jniDebuggable true
}
release {
minifyEnabled **MINIFY_RELEASE**
useProguard **PROGUARD_RELEASE**
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
**SIGNCONFIG**
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
It will be as follows.
buildTypes {
debug {
minifyEnabled **MINIFY_DEBUG**
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
jniDebuggable true
}
release {
minifyEnabled **MINIFY_RELEASE**
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'**USER_PROGUARD**
**SIGNCONFIG**
}
}
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12