Bivin
Bivin

Reputation: 373

Error while moving android project from eclipse to Android studio

I am moving my project from eclipse to android studio.when I run my project I get the following error.

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class

Error:(org.apache.commons.httpclient.HttpMethodBase$1) that doesn't come with an

Error:associated EnclosingMethod attribute. This class was probably produced by a

Error:compiler that did not target the modern .class file format. The recommended

Error:solution is to recompile the class from source, using an up-to-date compiler

Error:and without specifying any "-target" type options. The consequence of ignoring

Error:this warning is that reflective operations on this class will incorrectly

Error:indicate that it is not an inner class.

Error:warning: Ignoring InnerClasses attribute for an anonymous inner class

Error:(org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory$1) that doesn't come with an

Error:associated EnclosingMethod attribute. This class was probably produced by a

Error:compiler that did not target the modern .class file format. The recommended

Error:solution is to recompile the class from source, using an up-to-date compiler

Error:and without specifying any "-target" type options. The consequence of ignoring

Error:this warning is that reflective operations on this class will incorrectly

Error:indicate that it is not an inner class.

Error:Error converting bytecode to dex:

Cause: com.android.dex.DexException: Multiple dex files define Lorg/springframework/core/NestedRuntimeException;

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException

In my Build.gradle I have added the following dependencies.

android {
compileSdkVersion 23
buildToolsVersion "26.0.1"


defaultConfig {
    applicationId "com.buildteam"
    minSdkVersion 8
    targetSdkVersion 19
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }
    useLibrary 'org.apache.http.legacy'

}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
aaptOptions {
    cruncherEnabled = false
}

packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
}

}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.0'
compile files('libs/commons-httpclient-3.1.jar')
compile files('libs/jackson-annotations-2.4.3.jar')
compile files('libs/jackson-core-2.4.3.jar')
compile files('libs/jackson-databind-2.4.3.jar')
compile files('libs/jackson-mapper-asl-1.9.6.jar')

compile group: 'org.apache.httpcomponents' , name: 'httpclient-android' , version: '4.3.5'
compile 'org.springframework.android:spring-android-rest-template:2.0.0.M3'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:design:23.1.0'

}

I have tried so many questions from stack overflow. But I couldn't find a solution. Please help me.

Upvotes: 0

Views: 120

Answers (1)

dmp
dmp

Reputation: 66

Can you please do the following:

Update android studio to lastes Update android sdk and adt to latest Ideally use minSdkVersion (lowest possible) <= targetSdkVersion == compileSdkVersion (latest SDK) Please make the changes in build.gradle Wait for gradle to sync Run the application

After trying out the above steps, if we fail, please checkout the all changes made during the conversion of the project and convert the eclipse project to android studio project using android studio.

Upvotes: 0

Related Questions