Unsupported major.minor version 52.0 problem


#1

I have android platform:
android 6.1.2
I have ionic version:
2.2.1
I have cordova version:
6.5.0

and, when I try to run ionic run android, I get this:

Running 'run:before' gulp task before run
[14:21:00] Starting 'clean'...
[14:21:00] Finished 'clean' after 67 ms
[14:21:00] Starting 'build'...
[14:21:00] Starting 'sass'...
[14:21:00] Starting 'html'...
[14:21:00] Starting 'fonts'...
[14:21:00] Starting 'scripts'...
[14:21:00] Finished 'scripts' after 210 ms
[14:21:00] Finished 'html' after 259 ms
[14:21:00] Finished 'fonts' after 377 ms
[14:21:03] Finished 'sass' after 3.41 s
TypeScript error: C:/mobilecare-ionic2/PreverPressureReader/app/pages/chart/chart.ts(132,34): Error TS2339: Property 'datePicker' does not exist on type 'Window'.
TypeScript error: C:/mobilecare-ionic2/PreverPressureReader/app/pages/chart/chart.ts(149,34): Error TS2339: Property 'datePicker' does not exist on type 'Window'.
TypeScript error: C:/mobilecare-ionic2/PreverPressureReader/app/pages/pressure-register/pressure-register.ts(323,34): Error TS2339: Property 'datePicker' does not exist on type 'Window'.
TypeScript error: C:/mobilecare-ionic2/PreverPressureReader/app/pages/pressure-register/pressure-register.ts(341,34): Error TS2339: Property 'datePicker' does not exist on type 'Window'.
TypeScript error: C:/mobilecare-ionic2/PreverPressureReader/app/pages/pressure-register/pressure-register.ts(554,13): Error TS2304: Cannot find name 'cordova'.
[14:21:28] Finished 'build' after 28 s
[14:21:28] Starting 'run:before'...
[14:21:28] Finished 'run:before' after 8.21 μs

Running command: "C:\Program Files\nodejs\node.exe" C:\mobilecare-ionic2\PreverPressureReader\hooks\after_prepare\010_add_platform_class.js C:\mobilecare-ionic2\PreverPressureReader


add to body class: platform-android

Running command: "C:\Program Files\nodejs\node.exe" C:\mobilecare-ionic2\PreverPressureReader\hooks\after_prepare\020_remove_sass_from_platforms.js C:\mobilecare-ionic2\PreverPressureReader


ANDROID_HOME=C:\Android\sdk\

JAVA_HOME=C:\Program Files\Java\jdk1.7.0_79

Subproject Path: CordovaLib




BUILD FAILED

Total time: 2.727 secs

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\mobilecare-ionic2\PreverPressureReader\platforms\android\build.gradle' line: 20

* What went wrong:
A problem occurred evaluating root project 'android'.
> java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* Where:
Build file 'C:\mobilecare-ionic2\PreverPressureReader\platforms\android\build.gradle' line: 20

* What went wrong:
A problem occurred evaluating root project 'android'.
> java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

Can anyone help me? The only thing I could found about this problem was to uninstall Android SDK Build-tools 24, but I don’t have it installed. I’m completely lost.


#2

try look on the answer here:

hope it will help you.


#3

Not really. I’m building with ionic (command ionic run android) and all answers are related to Android Studio configurations.


#4

ionic run android still does a build in the background, so Android Studio is still relevant. “Unsupported major.minor version 52.0” in this case means that you are trying to build with a Java version less than 1.8, but there is code in your project that requires/was built by Java 1.8.

I don’t know what platform you’re on, but try installing the latest version of Java8 on your system, and then make sure the environment variable $JAVA_HOME is pointing to it.