Reputation: 3039
I installed Android Studio 4.1 recently, tried to run a sample project in Android Studio 4.1. Got this error:
A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
java.lang.IllegalArgumentException (no error message)
So I modified few lines as given below:
Changed gradle.properties
as
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
to
org.gradle.jvmargs=-Xmx4608m -Dfile.encoding=UTF-8
Updated minSdkVersion
to 21
Added Multidex
support
def multidex_version = "2.0.1" implementation "androidx.multidex:multidex:$multidex_version"
I even tried invalidate caches and restart
.
My classspath is classpath "com.android.tools.build:gradle:4.1.0"
and gradle version is gradle-6.5
.
I made sure that Android Studio 4.1 meets minimum compatibility as given in this link.
Then I tried to install the sample app in device. I got this error:
Execution failed for task ':app:packageDebug'.
A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable java.lang.IllegalArgumentException (no error message)
What is causing this? Is this a bug?
Upvotes: 0
Views: 3696
Reputation: 3039
I managed to fix it...
You have 3 options to fix that error (Error in question)
Add Multidex Support
Add these lines in dependencies
def multidex_version = "2.0.1"
implementation "androidx.multidex:multidex:$multidex_version"
Add this line to defaultConfig
:
multiDexEnabled true
Sync your project, see if that fixes your error.
If option 1 doesn't work, try increasing jvmargs
Add this line in gradle.properties
:
org.gradle.jvmargs=-Xmx4608m -Dfile.encoding=UTF-8
Sync and run your project.
If both options don't work, then delete .gradle
and build
folder in your project's directory. Run Clean project
and Rebuild project
. Then run the project.
NOTE: If above options doesn't work, then invalidate caches and restart
.
Upvotes: 9