2

I have a couple of days with this problem and I've read a lot about it ... but I can not fix it.

After updating android studio, I jump the following error:

UNEXPECTED TOP-LEVEL EXCEPTION

now I know it's a error shown When you are using different versions of the same library. the problem is that I can not fix it, I think I'm not repeating any library or using different versions of the same library...

I updated "Play Services" to the latest version available today, "7.3.0" ... but without success. I read that jar libraries used, in project folder "libs", must also be considered, but I do not know how to do it.

I read a lot of links about it, including Android Studio - UNEXPECTED TOP-LEVEL EXCEPTION: and UNEXPECTED TOP-LEVEL EXCEPTION in Android Studio... but I do not understand how to fix it.

These are my dependencies:

apply plugin: 'com.android.application'

repositories {
    mavenCentral()

    flatDir {
        dirs 'libs'
    }
}

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "vision.com.tree.one"
        minSdkVersion 16
        targetSdkVersion 21
        versionCode 24
        versionName "5.0.2"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'com.android.support:cardview-v7:21.0.+'
    compile 'com.android.support:recyclerview-v7:21.0.+'
    compile 'com.flaviofaria:kenburnsview:1.0.6'
    compile 'com.google.android.gms:play-services:7.3.0'
    compile 'com.nispok:snackbar:2.10.6'
    compile 'com.getbase:floatingactionbutton:1.9.0'
    compile 'com.parse.bolts:bolts-android:1.+'
    compile 'com.skyfishjy.ripplebackground:library:1.0.1'
    compile(name: 'viewpi', ext: 'aar')
    compile files('libs/easyanimation.jar')
    compile files('libs/YouTubeAndroidPlayerApi.jar')
    compile files('libs/commons-net-3.2.jar')
    compile files('libs/Parse-1.9.1.jar')
}

And this my libs folder:

enter image description here

I guess this happens with my other projects and the next time you update android studio. I would like to understand how to fix it.

I appreciate any help.

Greetings.

**Add error information:**
4 errors; aborting
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /Users/Sergio/android-sdks/build-tools/21.1.2/dx --dex --no-optimize --output /Users/Sergio/AndroidStudioProjects/Proyectos Android/AS/Vision/app/build/intermediates/dex/debug --input-list=/Users/Sergio/AndroidStudioProjects/Proyectos Android/AS/Vision/app/build/intermediates/tmp/dex/debug/inputList.txt

Error Code:
    1
  Output:
    UNEXPECTED TOP-LEVEL EXCEPTION:
    com.android.dx.cf.iface.ParseException: class name (adapters/Adapter_concursos$ViewHolder) does not match path (adapters/Adapter_concursos$ViewHolder (1).class)
        at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:520)
        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:83)
        at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:170)
        at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
        at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:229)
        at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:158)
        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.Main.run(Main.java:246)
        at com.android.dx.command.dexer.Main.main(Main.java:215)
        at com.android.dx.command.Main.main(Main.java:106)
    ...while parsing adapters/Adapter_concursos$ViewHolder (1).class

The error is repeated four times

Thanks.

Community
  • 1
  • 1
Sergio76
  • 3,835
  • 16
  • 61
  • 88

1 Answers1

1

I've fixed . If can help someone , this line:

compile fileTree(dir: 'libs', include: ['*.jar'])

...it was doubling the jar.

remove that line and declare the jars in the dependencies:

compile files('libs/easyanimation.jar')
compile files('libs/YouTubeAndroidPlayerApi.jar')
compile files('libs/commons-net-3.2.jar')

etc...

Sergio76
  • 3,835
  • 16
  • 61
  • 88