I have updated my Android Studio to Artic Fox as well as Gradle wrapper to 7.0.2 (plugin 7.0.0) and JDK 1.8 -> 11.
When I install a debug build on my device through Android Studio, it works, and no error.
Now whenever I try to create a release APK, the build always fails with a Lint error. Not sure what is going on.
w: Runtime JAR files in the classpath have the version 1.4, which is older than the API version 1.5. Consider using the runtime of version 1.5, or pass '-api-version 1.4' explicitly to restrict the available APIs to the runtime of version 1.4. You can also pass '-language-version 1.4' instead, which will restrict not only the APIs to the specified version, but also the language features
w: /Users/xxx/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.4.10/998caa30623f73223194a8b657abd2baec4880ea/kotlin-stdlib-jdk8-1.4.10.jar: Runtime JAR file has version 1.4 which is older than required for API version 1.5
w: /Users/xxx/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.4.31/84ce8e85f6e84270b2b501d44e9f0ba6ff64fa71/kotlin-stdlib-jdk7-1.4.31.jar: Runtime JAR file has version 1.4 which is older than required for API version 1.5
w: /Users/xxx/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.4.32/461367948840adbb0839c51d91ed74ef4a9ccb52/kotlin-stdlib-1.4.32.jar: Runtime JAR file has version 1.4 which is older than required for API version 1.5
w: /Users/xxx/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.4.32/ef50bfa2c0491a11dcc35d9822edbfd6170e1ea2/kotlin-stdlib-common-1.4.32.jar: Runtime JAR file has version 1.4 which is older than required for API version 1.5
/src/main/AndroidManifest.xml:23: Error: SplashScreenActivity must extend android.app.Activity [Instantiatable]
android:name="com.abc.xyz.activity.SplashScreenActivity"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/src/main/AndroidManifest.xml:36: Error: MainActivity must extend android.app.Activity [Instantiatable]
android:name="com.abc.xyz.activity.MainActivity"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/src/main/AndroidManifest.xml:66: Error: PlayerActivity must extend android.app.Activity [Instantiatable]
android:name="com.abc.xyz.activity.PlayerActivity"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Explanation for issues of type "Instantiatable":
/Users/xxx/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.4.10/998caa30623f73223194a8b657abd2baec4880ea/kotlin-stdlib-jdk8-1.4.10.jar: Runtime JAR file has version 1.4 which is older than required for API version 1.5
Activities, services, broadcast receivers etc. registered in the manifest
file (or for custom views, in a layout file) must be "instantiatable" by
the system, which means that the class must be public, it must have an
empty public constructor, and if it's an inner class, it must be a static
inner class.
/Users/xxx/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.4.31/84ce8e85f6e84270b2b501d44e9f0ba6ff64fa71/kotlin-stdlib-jdk7-1.4.31.jar: Runtime JAR file has version 1.4 which is older than required for API version 1.5
3 errors, 0 warnings
Lint found fatal errors while assembling a release target.
To proceed, either fix the issues identified by lint, or modify your build script as follows:
...
android {
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
I am not sure why do I have those Instantiatable
errors on activities. All these activities extend one BaesActivity
which extends AppCompatActivity
. So the error doesn’t really make any sense.
But when I downgrade Gradle wrapper to 6.7.1 (Plugin 4.2.2) and JDK 1.8…everything runs smoothly.
also, I have these warnings like
/Users/xxx/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.4.10/998caa30623f73223194a8b657abd2baec4880ea/kotlin-stdlib-jdk8-1.4.10.jar: Runtime JAR file has version 1.4 which is older than required for API version 1.5
What is this warning and how can I fix it?
3
Answers
After a lot of searching, I found the solution to this.
Build fails because of
Instantiatable
lint check.There are a couple of solutions to this,
build.gradle
(not desirable though)minifyEnabled
on a library-module, there is no need for that unless you are trying to publish a library module (.aar file).Refere issue from here.
More specifically this comment from here.
Go to File -> Settings, search
Kotlin Complier
and change language version to 1.4in the compiler settings, You can set api version, language version and command-line parameters.
I had the same issue. I can solve with this trick:
1) Clean Proyect
2) Rebuild Proyect
3) Open Emulator with some API
4) Change from Debug to Release (Active Build Variant)
5) Build Bundle / APKs > Build Bundle
I don’t know if it works for you.