Reputation: 768
I update my Android Studio version from 4.1 to 4.2 and the project is not compiling because the Proguard version was very old (4.7) and it was not compatible with Java 10, however I decided to migrate my project from proguard to R8, but the project is not compiling because of this error:
File not found: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/lib/rt.jar
Then I set R8 to false and use Proguard adding this line to my build.gradle in order to update my Proguard to a higher version:
classpath 'net.sf.proguard:proguard-gradle:6.1.1'
But still, I got the same error and not the first one that was telling me to update a newer version of Proguard.
So how I can fix that rt.jar? Maybe some directory change from one AS version and the other?, If I downgrade my android studio to 4.1 and revert all the changes that I did, the project works fine, but I want to upgrade Android Studio.
Upvotes: 8
Views: 1724
Reputation: 81578
There was a clause like this in the Proguard configuration, removing this solves the issue
-libraryjars <java.home>/lib/rt.jar(java/**,javax/**)
Upvotes: 4
Reputation: 1722
removing -libraryjars <java.home>/lib/rt.jar from proguard.txt should be the right way to go
mentioned by @sgjesse as a comment , that should be marked in answer.
applicable only after java version 8.
Upvotes: 4
Reputation: 4628
Starting from JDK 9 there rt.jar
is not longer part of the JDK, see Removed rt.jar and tools.jar in JDK 9 for details.
In most cases if rt.jar
was required for compilation before an rt.jar
from JDK 8 should work.
However, what is the reason for using rt.jar
on an Android project? Normally the android.jar
supplied by Android Studio/AGP when shrinking should work.
Upvotes: 4