-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Android studio build failed #128
Comments
Same here, any ideas / solution? This happens using android studio, adding a java module, adding a dependency jSerialComm: |
Downgrading to 1.3.11 works. |
It appears that Android Studio hasn't figured out how to ignore newer Java 9+ features, even though they aren't required for this library to work. Until that is resolved, you can use the following as a workaround in your Android gradle.build file: If it already includes a 'configurations' section, add the word 'repackage' to its list of arguments. If it does not include a 'configurations' section, add the following code to gradle.build somewhere above the 'dependencies' section:
In the 'dependencies' section, remove any lines you currently have referencing jSerialComm, and replace them with:
such that your 'dependencies' section has a form similar to:
Finally, add the following code to the very bottom of your gradle.build file:
Save and rebuild your project, and it should automatically remove any Java 9 features from the library such that it can be successfully built and used in your Android application. |
Did not work for me? |
Simply delete the 'module-info.class' file from the jSerialComm JAR file (opened using a zip file editor). This is an Android Studio issue. |
Getting closer.... Program type already present: com.fazecast.jSerialComm.SerialPort$SerialPortEventListener$1 Any suggestions? |
I removed the jar and so files I had downloaded and added But it crashes... Do I have to install the .so file somewhere an my Android Oreo 8.1? Debugging I see the following: It seems to lock on the following line: I think the .so files are not being used correctly? Please help??? 2018-09-24 23:11:09.458 16045-16045/com.xxxx.xxxx.demo E/zygote64: No implementation found for com.fazecast.jSerialComm.SerialPort[] com.fazecast.jSerialComm.SerialPort.getCommPorts() (tried Java_com_fazecast_jSerialComm_SerialPort_getCommPorts and Java_com_fazecast_jSerialComm_SerialPort_getCommPorts__)
2018-09-24 23:11:09.461 16045-16045/com.xxxx.xxxx.demo E/AndroidRuntime: FATAL EXCEPTION: main |
Should the versions be arm64-v8a? |
My .apk file includes OSX and Windows but not Android. What have I done wrong? |
I cant open port in android studio 02-08 12:58:10.996 14495-14495/com.hasar.hasarmposdriver W/System.err: Could not locate or access the native jSerialComm shared library. Any ideas what im doing wrong? |
I encountered the same problem, and I finally found a workaround solution. First, before you try repackaging, please make sure you install NDK tools because jSerialComm contains native codes. Second, after adding the repackaging Gradle script into your project, you need to satisfy linking by adding shared libraries, ".so" files, into JNI source directories. Sample Gradle task: // copy .so files from repackagedLibs.jar into jniLibs
task copySharedLibraries(type: Copy) {
from(zipTree('libs/repackagedLibs.jar')) {
include 'Android/*/libjSerialComm.so'
}
into('src/main/jniLibs/')
eachFile {item ->
item.path = item.path.replaceAll(/Android\/(.*?)\/libjSerialComm.so/, '$1/libjSerialComm.so')
}
doLast {
delete 'src/main/jniLibs/Android/'
}
} That is all for my workaround. |
I create a project using jSerialComm in Android studio by gradle.
But build failed with error:
Illegal class file: Class module-info is missing a super type.
The text was updated successfully, but these errors were encountered: