What is the best way to resolve UNCERTAINT FUEL EXCLUSION?

When I make the application, use a lot of libraries. I usually encounter an error: UNEXPECTED TOP-LEVEL EXCEPTION

This error has some reasons like:

  • Number function> 65k, we need to enable multidex for it
  • There are several libs nested, we need to add exclude to build.gradle.

Regarding the second case, it is very difficult to determine which libraries were nested.

If you have experience on this issue, please share me.

UPDATE:

 dependencies { compile files('libs/ormlite-android-4.48.jar') compile files('libs/ormlite-core-4.48.jar') // compile 'com.obsez.android.lib.filechooser:filechooser:1.1.2' // compile 'com.github.bumptech.glide:glide:3.6.1' compile 'com.android.support:recyclerview-v7:23.1.1' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.jakewharton:butterknife:7.0.1' compile 'cn.lightsky.infiniteindicator:library:1.0.5' compile 'com.firebase:firebase-client-android:2.3.1' compile 'de.hdodenhof:circleimageview:2.0.0' compile 'com.mcxiaoke.volley:library:1.0.15' compile('com.google.apis:google-api-services-drive:v2-rev170-1.20.0') { exclude group: 'org.apache.httpcomponents' } compile('com.google.api-client:google-api-client-android:1.20.0') { exclude group: 'org.apache.httpcomponents' } compile('com.google.android.gms:play-services:8.4.0') { exclude group: 'com.android.support', module: 'support-v4' } compile 'com.nononsenseapps:filepicker:2.4.1' } 
+5
source share
1 answer

Best Ways to Solve an UNCERTAIN TOP EXCLUSION LEVEL? I suggest you this step Two to solve this problem.

  • Check Nested Libraries Dependency / Hierarchy
  • Check which library class or files are causing duplication. The number of files or methods exceeds 65 thousand.


  • How to check attached libraries Dependency / hierarchy?

First, a dependency is found that is used in a library that is attached / compiled from maven / jcenter / mavencentral. The main problem will be related to support, because it is possible that support-v4 and appcompact are already contained in the library that is attached to maven (for example, the playback service contains v4, appcompact is attached, then there is no need to attach support-v4 because it already contains. )

How to check dependency / hierarchy of attached library in gradle

Gradle menu>: modulename β†’ Tasks β†’ android β†’ Run "androidDependcies"

OR

Gradle menu>: application β†’ Tasks β†’ android β†’ Run "androidDependcies"

Having done this in the Gradle Console , you will get something like below as output (the output may depend on the connected libraries). What can give an idea of ​​duplication / hierarchy of libraries

 release +--- LOCAL: picasso-2.5.2.jar +--- LOCAL: YouTubeAndroidPlayerApi.jar +--- LOCAL: commons-lang-2.6.jar +--- LOCAL: signpost-core-1.2.1.1.jar +--- LOCAL: kxml2_2.3.0.jar +--- LOCAL: classes.jar +--- LOCAL: signpost-commonshttp4-1.2.1.1.jar +--- LOCAL: json-simple-1.1.1.jar +--- LOCAL: universal-image-loader-1.9.3.jar +--- LOCAL: linkedin-j-.jar +--- LOCAL: maps.jar +--- LOCAL: nineoldandroids-2.4.0.jar +--- com.android.support:multidex:1.0.1 +--- com.android.support:multidex:1.0.1 +--- com.android.support:appcompat-v7:23.1.1 | \--- com.android.support:support-v4:23.1.1 | \--- LOCAL: internal_impl-23.1.1.jar +--- com.google.android.gms:play-services-maps:7.3.0 | \--- com.google.android.gms:play-services-base:7.3.0 | \--- com.android.support:support-v4:23.1.1 | \--- LOCAL: internal_impl-23.1.1.jar +--- com.google.android.gms:play-services-gcm:7.3.0 | \--- com.google.android.gms:play-services-base:7.3.0 | \--- com.android.support:support-v4:23.1.1 | \--- LOCAL: internal_impl-23.1.1.jar +--- com.google.android.gms:play-services-location:7.3.0 | +--- com.google.android.gms:play-services-base:7.3.0 | | \--- com.android.support:support-v4:23.1.1 | | \--- LOCAL: internal_impl-23.1.1.jar | \--- com.google.android.gms:play-services-maps:7.3.0 | \--- com.google.android.gms:play-services-base:7.3.0 | \--- com.android.support:support-v4:23.1.1 | \--- LOCAL: internal_impl-23.1.1.jar +--- com.google.android.gms:play-services-ads:7.3.0 | +--- com.google.android.gms:play-services-base:7.3.0 | | \--- com.android.support:support-v4:23.1.1 | | \--- LOCAL: internal_impl-23.1.1.jar | \--- com.google.android.gms:play-services-analytics:7.3.0 | \--- com.google.android.gms:play-services-base:7.3.0 | \--- com.android.support:support-v4:23.1.1 | \--- LOCAL: internal_impl-23.1.1.jar +--- com.google.android.gms:play-services-analytics:7.3.0 | \--- com.google.android.gms:play-services-base:7.3.0 | \--- com.android.support:support-v4:23.1.1 | \--- LOCAL: internal_impl-23.1.1.jar +--- com.google.android.gms:play-services-plus:7.3.0 | \--- com.google.android.gms:play-services-base:7.3.0 | \--- com.android.support:support-v4:23.1.1 | \--- LOCAL: internal_impl-23.1.1.jar \--- com.android.support:recyclerview-v7:23.1.1 \--- com.android.support:support-v4:23.1.1 \--- LOCAL: internal_impl-23.1.1.jar 

You can also check this from the terminal for the above process.

 gradlew app:dependencies 

You can check the image below because "an image is worth a thousand words"

a picture is worth a thousand words

How to check which class or files causing duplicate input / number of methods exceeds 65,000?

Instead of checking the message or error you get on the Message tab in Android Studio, check it in the Gradle Console

If the message contains an error, as when transferring classes to dex :app:transformClassesWithDexForDebug or :app:transformClassesWithDexForRelease , the maximum chances are similar to multiple dex (excess method 65k).

Or, if there is any other error than it will indicate as a duplicate entry, etc.

+5
source

Source: https://habr.com/ru/post/1243379/


All Articles