Closed pratamawijaya closed 6 years ago
It happens also to me
The class files in the jar file under the dist
directory of this project were compiled to target java 8. This is part of the output of javap -verbose
on Tokens.class
:
public class com.authy.api.Tokens extends com.authy.api.Resource
minor version: 0
major version: 52
flags: ACC_PUBLIC, ACC_SUPER
The major version of 52 corresponds to 34 in hex (as you're seeing in the error). And 52 is the class file version targeted by java 8 as you can see by the following:
$ javac -source 7 -target 7 MyTest.java
$ file MyTest.class
MyTest.class: compiled Java class data, version 51.0
$ javac -source 8 -target 8 MyTest.java
$ file MyTest.class
MyTest.class: compiled Java class data, version 52.0
You must be compiling the project with an earlier version of java, or maybe a -target
and/or -source
argument earlier than 1.8, or maybe android itself enforces that class files must be of an earlier version.
If you must have the authy code compiled to an earlier jvm target, then your only option would seem to be to clone the project. Compile it yourself with a target of 7/1.7 (or earlier as need be). And use that jar as a dependency instead of the one inside dist
.
@pratamawijaya Authy released a verification SDK that can be integrated in Android more securely.
Using authy-java on Android most likely means embedding you api_key
in the app which is not very secure.
this helper is intended for backend only, please check the library that @yuniersoad mentioned.
I want implement authy verification on my android apps, but after add .jar library, i cant run my apps, here are my error log
my java version 1.8.0_31