Build Error Running ProGuard on Android Studio

Asked 2 years ago, Updated 2 years ago, 88 views

Enable ProGuard on Android Studio and

./gradlew assemblyRelease

When building with the above command, the following error occurs:

FAILURE: Build failed with an exception.

  • What was wrong: Execution failed for task':app:proguardRelease'.

    java.io.IOException: Can't read [[project_path]/app/android-support-v4.jar(;;;;;!META-INF/MANIFEST.MF)] (No such file or directory)

java.io.IOException: Can't read [[project_path]/app/android-support-v4.jar(;;;;;!META-INF/MANIFEST.MF)] (No such file or directory)

I think it's probably an error (described later) due to multiple libraries including android-support-v4, but I don't know the correct solution.

Please let me know if anyone knows an effective solution to the above.

By the way, I use android-support-v7-appcompat and facebook for the library. I import it as a library project.

build.gradleExcerpts:

 dependencies {
    compilefileTree (dir: 'libs', include: ['*.jar'])
    compile project(':External:android-support-v7-appcompat')
    compile project(':External:facebook:facebook')
    compile project(':External:PagerSlidingTabStrip:library')
}

android android-studio gradle

2022-09-30 20:10

1 Answers

./gradlew-q dependencies

Check the dependencies in

You'll probably find some com.android.support:support-v4.Leave only support-v4, which depends on com.android.support:appcompat-v7, and exclude all others.

 dependencies {
    compile project(':External:android-support-v7-appcompat')

    compile('com.example.foo.bar:xxx'){
        exclude module: 'support-v4'
    }
}

If the libs directory contains android-support-v4.jar, delete it.


2022-09-30 20:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.