Android Studio 1.0 failing build at dexDebug or dexRelease - android

I recently upgraded from Android Studio 0.9.2 to 1.0 (including version 1.0.0 of the Gradle plugin) and I'm having an issue with building my project.
Whenever I build I get the following exception at the dexDebug or dexRelease step:
UNEXPECTED TOP-LEVEL ERROR:
java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.util.HashMap.createEntry(HashMap.java:897)
at java.util.HashMap.addEntry(HashMap.java:884)
at java.util.HashMap.put(HashMap.java:505)
at com.android.dx.rop.type.Type.putIntern(Type.java:857)
at com.android.dx.rop.type.Type.intern(Type.java:365)
at com.android.dx.rop.type.Type.internClassName(Type.java:415)
at com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:289)
at com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:299)
at com.android.dx.cf.cst.ConstantPoolParser.parse(ConstantPoolParser.java:150)
at com.android.dx.cf.cst.ConstantPoolParser.parseIfNecessary(ConstantPoolParser.java:124)
at com.android.dx.cf.cst.ConstantPoolParser.getPool(ConstantPoolParser.java:115)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:482)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:704)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:82)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:505)
at com.android.dx.command.dexer.Main.runMultiDex(Main.java:332)
at com.android.dx.command.dexer.Main.run(Main.java:243)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)
I tried increasing the heap size of Android Studio to -Xmx4096m but to no avail.
In Android Studio 0.9.2 with version 0.14 of the gradle plugin building worked fine.
This is the build.gradle file of my project:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
And this is the build.gradle file of my module:
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:appcompat-v7:21.+'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
compile 'com.android.support:multidex:1.+'
compile 'com.google.android.gms:play-services:6.5.+'
compile 'org.jsoup:jsoup:1.8.+'
compile 'commons-io:commons-io:2.4'
compile 'org.apache.commons:commons-lang3:3.3.2'
compile 'com.rometools:rome:1.5.0'
compile 'com.google.apis:google-api-services-blogger:v3-rev44-1.19.0'
compile 'com.google.http-client:google-http-client-gson:1.19.0'
compile 'org.apache.commons:commons-collections4:4.0'
compile 'com.parse.bolts:bolts-android:1.1.2'
compile files('libs/android-query.0.26.8.jar')
compile files('libs/Parse-1.7.1.jar')
}
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
minSdkVersion 10
targetSdkVersion 21
versionCode 1040009
versionName "1.4"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-dcrapp.txt'
shrinkResources true
}
debug {
minifyEnabled false
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-dcrapp.txt'
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
//Bugfix for Gradle build bug
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
task copyMappingFiles(type: Copy)
copyMappingFiles {
from 'build\\outputs\\mapping\\release'
into 'mappings\\'+android.defaultConfig.versionCode
include('mapping.txt')
}
assembleRelease.finalizedBy copyProguardFiles
What could be the cause of this issue and how can it be solved?

Looks like Android Studio ran out of memory, try increasing the memory size in AndroidStudio.app/Contents/bin/studio.vmoptions
-Xms256m
-Xmx1024m
-XX:MaxPermSize=350m
-XX:ReservedCodeCacheSize=96m
-XX:+UseCompressedOops
as per suggested from answers in Android Studio - How to increase Allocated Heap Size
Additionally you may want to add
dexOptions {
javaMaxHeapSize "4g"
}
to your module build.gradle as per Android Studio Google JAR file causing GC overhead limit exceeded error

Looks like dexing runs out of memory. Try:
android {
dexOptions {
javaMaxHeapSize "2048M"
}
}
For additional options, see dex options in the Gradle Plugin User Guide.

Related

Gradle unable to compile NDK files

I got the source of a project (An android application) from github and I am trying to launch it, the project is called "RtkGps+" it's an Anroid application to that use a C++ libary called Rtklib to play with GPS and Raw measurements.
My Android environment configuration is bellow,
Gradle version : 3.1.3
NDK revision : 19.0.5232133
I'm unable to compile the project, I got the errors bellow :
As shown in the the capture there are many errors, that I want to enumate them,
So the first one is this error where the NDK_PROJECT_PATH=null
SIMPLE: Error while executing process C:\Users\Yazid\AppData\Local\Android\Sdk\ndk-bundle\ndk-build.cmd with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=C:\Users\Yazid\Documents\Dev\Android\RtkGps-master\RtkGps-master\jni\Android.mk NDK_APPLICATION_MK=C:\Users\Yazid\Documents\Dev\Android\RtkGps-master\RtkGps-master\jni\Application.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-21 NDK_OUT=C:/Users/Yazid/Documents/Dev/Android/RtkGps-master/RtkGps-master/build/intermediates/ndkBuild/release/obj NDK_LIBS_OUT=C:\Users\Yazid\Documents\Dev\Android\RtkGps-master\RtkGps-master\build\intermediates\ndkBuild\release\lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n}
The second one is saying that the Android.mk file is not supported
SIMPLE: Android NDK: WARNING: Unsupported source file extensions in C:\Users\Yazid\Documents\Dev\Android\RtkGps-master\RtkGps-master\jni\Android.mk for module rtklib
I tried adding gradle code from this answer : https://stackoverflow.com/a/50707270/6306138
The Gradle file of the project.
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
}
}
apply plugin: 'com.android.application'
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
implementation group: 'cz.msebera.android' , name: 'httpclient' , version: '4.4.+'
implementation 'com.android.support:support-v13:27.1.1'
implementation 'com.google.gms:google-services:3.2.1'
implementation 'com.google.android.gms:play-services-gcm:11.0.4'
implementation 'com.google.code.findbugs:jsr305:3.0.2'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.karumi:dexter:5.0.0'
implementation 'ch.acra:acra:4.5.0'
implementation 'commons-net:commons-net:3.6'
implementation 'org.slf4j:slf4j-api:1.7.25'
implementation 'com.infstory:proguard-annotations:1.0.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
android {
sourceSets.main.res.filter.exclude '**/proj4/jniwrap/org/**'
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "gpsplus.rtkgps"
minSdkVersion 21
targetSdkVersion 26
multiDexEnabled true
ndk {
abiFilters = []
abiFilters.add('armeabi-v7a')
abiFilters.add('x86')
abiFilters.add('x86_64')
abiFilters.add('arm64-v8a')
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDir 'libs'
}
// instrumentTest.setRoot('tests')
}
externalNativeBuild {
ndkBuild {
path 'jni/Android.mk'
}
}
packagingOptions{
doNotStrip '*/mips/*.so'
doNotStrip '*/mips64/*.so'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
debug {
debuggable true
jniDebuggable false
renderscriptDebuggable false
}
}
productFlavors {
}
}
Neither of the "errors" mentioned are errors. NDK_PROJECT_PATH=null is normal behavior for Studio, and the second is just a warning.
Without seeing your Android.mk or the full error message (the line immediately after the one you included tells you what went wrong) I can't tell you how to fix the warning, but like the warning says, one of your source files has an unrecognized extension so ndk-build didn't know how to build it.

Android project compiles and runs without module-level build.gradle. Is it right?

I have got a 3 years old project (Android service) where there is only a top level (project-level) build.gradle file.
The file looks like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
android {
compileSdkVersion 21
buildToolsVersion "22.0.1"
productFlavors {
arm {
ndk {
abiFilters = ["armeabi-v7a", "arm64-v8a"]
}
}
}
defaultConfig {
applicationId "com.mycompany.myapp"
minSdkVersion 17
targetSdkVersion 19
versionCode 1
versionName "9.99.99.99"
}
signingConfigs {
release {
storeFile file("myapp.jks")
storePassword "mypwd"
keyAlias "myalias"
keyPassword "mykeypwd"
}
}
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug{
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
jniLibs.srcDirs = ['libs']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
All documents and tutorials I have read, including Google and Gradle official documentation, state that there should be 2 Gradle files, project-level and module-level.
My project has only one, project-level, build.gradle file, that looks like a combination of two. The project compiles and runs without any problem. So, is the module-level build.gradle a must if the project has only one module?
one does not necessarily require modules (that was common at times of Eclipse IDE with Android ADT and ant or mvn), while you could split the file at apply plugin: 'com.android.application'and move that into a sub-directory and reference it as a module in settings.gradle (which became merely the standard with Android Studio).
it basically depends, if one may require further modules in a project - and while having a project with one sub-project by default, it's less effort to add and/or remove further modules, without having to mess around first. also, this can reduce build times, when not always having to rebuild the whole code-base, but only the module one has changed.

Multidex :no class found exception

my app exceeding 64k methods so iam supposed to implement Multidex ,
initially i had problem as "local path doesnt exist" i fixed that problem ,now gradle generated classes1.dex and classes2.dex ,
but not working in lower than lollipop..it was working fine in lollipop since it has a native support .error says that "<1st activity> is not present in dex path"
after seeing some tutorials they said that have to do a change in 1.gradle 2.application class 3.manifest
i dont have much knowledge about application class ..kindly guide me thanks
note:this is an imported project from eclipse .
kindly check build.gradle file
apply plugin: 'com.android.application'
android {
defaultConfig {
compileSdkVersion 23
buildToolsVersion '23.0.1'
minSdkVersion 15 //lower than 14 doesn't support multidex
targetSdkVersion 23
}
dexOptions {
jumboMode = true
preDexLibraries = false
javaMaxHeapSize "2048M"
}
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = ['--multi-dex']
} else {
dx.additionalParameters += '--multi-dex'
}
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
productFlavors {
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:multidex:1.0.1'
}
You followed a tutorial that shows how you could add multi-dex support manually before Android gradle plugin had support for it. Since v0.14.0, all you need to do is to add:
android {
defaultConfig {
...
multiDexEnabled true
}
And you can choose one of three options to call the MultiDex code. From MultiDexApplication documentation:
Minimal MultiDex capable application.
To use the legacy multidex library there is 3 possibilities:
- Declare this class as the application in your AndroidManifest.xml.
- Have your Application extends this class.
- Have your Application override attachBaseContext starting with
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
Don't forget to remove the afterEvaluate block from your build script.
Make sure you've read the official documentation.

UNEXPECTED TOP-LEVEL EXCEPTION: android studio and andengine duplicate classes

I'm using Android Studio and AndEngine library and TexturePacker Extension using this link to setup:
Setting Up AndEngine with Android Studio
I'm getting that issue:
Error:Class org.andengine.BuildConfig has already been added to output. Please remove duplicate copies.
1 error; aborting
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\Diego\android-sdks\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Users\Diego\NEXT\Next\app\build\intermediates\dex\debug --input-list=C:\Users\Diego\NEXT\Next\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
1
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lorg/andengine/BuildConfig;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
at com.android.dx.command.dexer.Main.processClass(Main.java:732)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:83)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
at com.android.dx.command.dexer.M...(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
1 error; aborting
I've tried everything. Cleaning project, deleting BuildConfig classes (they are created automatically in texturepacker library), excluding modules, reimporting third_party libraries... but nothing seems to fix it.
Here my build.gradle files:
App:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.zmaxstudios.next"
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v13:21.0.3'
compile project(':third_party:andengine')
compile project(':third_party:texturepacker')
}
AndEngine > build.gradle
apply plugin: 'android-library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-project.txt')
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
Texturepacker > build.gradle
apply plugin: 'android-library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-project.txt')
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
}
}
dependencies {
compile project(':third_party:andengine')
}
How can remove duplicated BuildConfig files? Or what should I do to fix that?
Thanks
Your problem looks like it lies in your dependencies, something like this, in my case.
compile 'com.google.android.gms:play-services:6.5.87'// and here's the issue
The Google Play Services libraries can be quite large and when combining in a lot of third party libraries or some newer Google libraries, that can be redundancies as your experiencing. I ran into a similar issues when implementing Google Cloud Storage. Typically I now just include what I really need from the android support libraries, i.e.
compile 'com.google.apis:google-api-services-storage:v1-rev18-1.19.0'
compile 'com.google.http-client:google-http-client-jackson2:1.20.0'
compile 'com.google.oauth-client:google-oauth-client-jetty:1.20.0'
compile 'com.google.api-client:google-api-client-java6:1.20.0'
compile 'com.google.android.gms:play-services-maps:7.3.0'
compile 'com.google.android.gms:play-services-location:7.3.0'
can you please remove this line from dependencies I'm seeing here you are using two support libraries. clean and build your project
compile 'com.android.support:support-v13:21.0.3'
I've finally solved the problem, that it wasn't with support libraries. I was getting the problem form third_party libraries, because manifest file of texturepacker library had the same package of andengine following the steps in link provided in the question, so BuildConfig.java classes was being duplicated. Now, the manifest files are:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.andengine" >
<application>
</application>
</manifest>
And texturepacker:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.andengine.extension.texturepacker.opengl.texture.util.texturepacker" >
<application>
</application>
</manifest>
Hope that can be helpfull.
Thanks all the answers.

Android Studio - java.lang.RuntimeException: Unable to instantiate application

I am working on a project in eclipse, but after sometime it giving me error like "Unable to execute dex: method ID not in" as single DEX file having 65k method limitations.
To overcome the issue I come into the picture of Gradle plugin v0.14.0 for Android adds support for Multi-Dex. So I moved to Android Studio.
I have updated SDK and exported project from eclipse as per Migrating from Eclipse.
Now I have project structure required in Android Studio.Their is dependency of project on ABS, Google Play Service lib and android multidex support lib. I have added these libraries to my project folder named "libraries".
Project Gradle file looks something below:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.14.1'
}
}
apply plugin: 'com.android.application'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':libraries:ABS')
compile project(':libraries:GooglePlayServiceLib')
compile (project(':libraries:android-support-multidex')) {
exclude group: 'com.android.support', module: 'support-v4'
}
compile "com.android.support:support-v4:21.0.0"
}
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
dexOptions {
preDexLibraries = false
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
buildTypes {
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
}
afterEvaluate {
tasks.matching {
it.name.startsWith('dex')
}.each { dx ->
if (dx.additionalParameters == null) {
dx.additionalParameters = ['--multi-dex']
} else {
dx.additionalParameters += '--multi-dex'
}
}
}
When I clean and build project it builds successfully. But when I run project as android application giving me following error:
java.lang.RuntimeException: Unable to instantiate application java.lang.ClassNotFoundException: Didn't find class on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.example-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example-2, /vendor/lib, /system/lib]]
I am thinking that application is not compiling AndroidManifest.xml OR I am something missing ?
Any help is going to be appreciated. :)

Categories

Resources