Eclipse Java - Android app using serial do not work - java

I'm trying to use an app in Eclipse (v3.8), but it don't work.
The API is 19, and the app is Serial_Port_1.1.apk
My method: (I'm new with eclipse)
Extract the apk with apktool
Import the folder with Eclipse
Run as: Android application
I got theses errors:
threadid=1: thread exiting with uncaught exception (group=0xb3ac2ba8)
FATAL EXCEPTION: main
Process: android_serialport_api.sample, PID: 1508
java.lang.RuntimeException: Unable to instantiate application android_serialport_api.sample.Application: java.lang.ClassNotFoundException: Didn't find class "android_serialport_api.sample.Application" on path: DexPathList[[zip file "/data/app/android_serialport_api.sample-1.apk"],nativeLibraryDirectories=[/data/app-lib/android_serialport_api.sample-1, /vendor/lib, /system/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:516)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4317)
I'm trying to connect an Arduino to Eclipse, and the app works fine on a real system (ARM Orange Pi)

As it says in the LogCat, there is a ClassNotFoundException when you try to run it after decompile. As I understood, the original app works but after decompile + recompile it won't work again, throwing a CNF. This means that your decompile process didn't work properly. I suggest you trying the Android APK Decompiler, which is a free online tool.
Note: I haven't tested it yet, but it should work.

Related

Android WireApp logs UnsatisfiedLink error: "wcall_set_video_send_state" when attempting video calls

I've built the wire app from the following repository:
https://github.com/wireapp/wire-android
Using the following build directions:
How to build locally Check out the wire-android repository. Switch to
latest relase branch release From the checkout folder, run ./gradlew
assembleProdRelease. This will pull in all the necessary dependencies
from Maven.
I've tried the release branch:
git clone https://github.com/wireapp/wire-android.git --branch release
And the master:
git clone https://github.com/wireapp/wire-android.git
Initially both versions gave the error:
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.UnsatisfiedLinkError: Error looking up function 'wcall_set_video_send_state': undefined symbol: wcall_set_video_send_state
at com.sun.jna.Function.<init>(Function.java:245)
at com.sun.jna.NativeLibrary.getFunction(NativeLibrary.java:566)
However, this error can be solved by running the following command prior to opening the project in Android Studio:
gradlew assembleProdRelease
This command also creates the apks in build/output/apks. However, the build isn't signed with either the release or debug key. I used the following tool to sign the apk:
https://github.com/patrickfav/uber-apk-signer/releases
The APK is stable and runs fine, but still cannot initiate a video call. It gives the following errors:
Android 5:
08-24 22:53:29.877 296-881/? E/FastThread: did not receive expected
priority boost
Android 8:
08-24 23:10:02.190 406-4592/? E/AudioALSAPlaybackHandlerBase:
-getHardwareBufferInfo(), pcm_get_htimestamp fail, ret = -1, pcm_get_error =
Android 9 Emulator:
08-25 19:56:58.425 1583-3268/? W/audio_hw_generic: Not supplying
enough data to HAL, expected position 4108693 , only wrote 4108320
UPDATE:
I thought about trying to build my own versions of the AVS libraries: following https://github.com/wireapp/wire-audio-video-signaling
The following command needs to be run:
make dist_android
C:\work\wire-audio-video-signaling>make dist-android mk/target.mk:167:
*** Unknown host system. Stop.
mk/target.mk looks like:
# Start by auto-determining host system and arch.
ifeq ($(HOST_OS),)
HOST_UNAME := $(shell uname)
ifeq ($(HOST_UNAME),Darwin)
HOST_OS := osx
else
ifeq ($(HOST_UNAME),Linux)
HOST_OS := linux
else
$(error Unknown host system)
endif
endif
endif
The Makefile doesn't seem to be setup to support Windows so I'm going to try building it from a Linux machine to see if that helps.
UPDATE 2:
It does build better on Ubuntu, but it eventually dies complaining about compiler arguments. [Sorry I don't have the error to hand]
But I've managed to find binary copies of the library built for Android/ARM here:
http://dl.bintray.com/wire-android/releases/com/wire/avs/
However, these libraries do not seem to solve the issue either.
UPDATE 3:
Tried the following:
Downloaded the latest version of the .aar file from the link above
Renamed it to avs.aar
Installed in app/libs
Uncommented the line: "implementation (name:'avs', ext:'aar')"
But I got the error:
Program type already present: com.waz.avs.VideoCapturer$4
Message{kind=ERROR, text=Program type already present:
com.waz.avs.VideoCapturer$4, sources=[Unknown source file], tool
name=Optional.of(D8)}
There is a another reference to the AVS library below, if you comment that out the error will go away.
However, none of these steps solve the problem.
Now I will try to build older versions of the release branch...
Update 4: Release Branch: 2.41.359
[The most recent non-beta tagged release]
No longer compiles in Android studio because some of the XML files in the layout DIR are not well formed. Those must be fixed and checked into Git since the build process checks all the files out from Git.
The app initially runs normally and allows login, but always crashes after the edit devices screen. The app then crashes every time that you try to open it.
08-25 14:51:02.142 29066-29109/? E/AndroidRuntime: FATAL EXCEPTION:
Thread-4
Process: com.wire, PID: 29066
java.lang.NullPointerException: Attempt to invoke interface method 'int com.waz.call.RequestHandler.request$1d4ff469()' on a null object
reference
at com.waz.call.FlowManager.request(FlowManager.java:365)
Note: Seems that edit devices screen is not the cause of the problem because I removed all my devices in the web app but then 2.41.359 crashes on the phone without displaying the edit devices screen.
This issue is mentioned in following threads:
https://github.com/wireapp/wire-android/issues/1271
https://github.com/wireapp/wire-android/issues/1288
The advice seems to be to use the avslib.so file from the production version since the provided one is inadequate to run the project.
So I've dowloaded the APK off their website:
https://wire.com/en/download/
It is version: 3.15.634 [That's older than the one in the app store: 3.16.638 though hopefully that doesn't matter].
For anyone that doesn't know, an APK is just a ZIP file so I renamed it to from .apk to .zip for purposes of obtaining libavs.so:
Root Dir:
Libs Dir:
Arm Dir:
With libavs.so extracted, I renamed the unsigned version of wire-prod-release-2.41.99999 produced by the build tools to wire-prod-release-2.41.99999-avs-mod.zip and deleted the old libavs.so and replaced it with the one that I just took from the production version of the app. I renamed it back to .pkg then ran the following command to sign it:
java -jar \uber-apk-signer-0.8.4.jar --apks wire-prod-release-2.41.99999-avs-mod.apk -debug
Pretty good result, 2.41.359 no longer crashes. However, I still cannot initiate any audio or video calls. Same error found in the latest version of the release branch:
08-25 16:01:51.748 406-4592/? E/AudioALSAPlaybackHandlerBase: -getHardwareBufferInfo(), pcm_get_htimestamp fail, ret = -1, pcm_get_error =
As a sanity check, I installed the production version: 3.15.634 used to extra libavs.so and it is able to make both audio and video calls. [The version on GooglePlay: 3.16.638 also works fine for audio and video...]
Any ideas?
After a few days of trying, I found a way to build the project in such a way that it will initiate audio and video calls:
Procedure:
git clone https://github.com/wireapp/wire-android.git --branch release
cd wire-android
git checkout 2.40.357
Load the project into Android Studio
Edit the file res/layout/collection_file_asset.xml
Move <?xml version="1.0" encoding="utf-8"?> above the copyright comment since the file must begin with the XML tag
git add .
git commit -m "fixed syntax error"
gradlew assembleProdRelease
java -jar \uber-apk-signer-0.8.4.jar --apks wire-prod-release-2.40.99999.apk -debug
adb install wire-prod-release-2.40.99999-aligned-debugSigned.apk
Other Notes:
Master currently does not build due to Scala errors...
The current release branch produces a stable app but results in the following error when tapping on the video icon: "E/AudioALSAPlaybackHandlerBase: -getHardwareBufferInfo(), pcm_get_htimestamp fail, ret = -1, pcm_get_error ="
The most recent stable release 2.41.359 does not work because it crashes on every app launch with: "AndroidRuntime: FATAL EXCEPTION: Thread-4 Process: com.wire, PID: 29066 java.lang.NullPointerException: Attempt to invoke interface method 'int com.waz.call.RequestHandler.request$1d4ff469()' on a null object reference at com.waz.call.FlowManager.request(FlowManager.java:365)"
While building 2.40.357 enables audio and video, it is unstable and crashes quite a bit while receiving and making calls. I've spoken with other developers using this code base and they've encountered similar problems...
Thoughts:
I'm not really sure what's happening with this project. There are developers pleading for help with audio / video issues on Git with little response. I think I'd feel a little uneasy about using this code for a commercial project unless there is a bit more stability and support...
I gave up to compile a working application from source. Aside from educational reasons, my motivation to compile from source was a particular code change (lifting the limit of simultaneous accounts in the android app, as I have more than 2)
Doing that change itself is trivial, its just a constant defined in
app/src/main/scala/com/waz/zclient/pages/main/profile/preferences/pages/ProfileBottomSheetDialog.scala:
val MaxAccountsCount = 2
However, since no working application can be built from the provided sources - even with considerable effort - I instead used the smali/backsmali tool from
https://github.com/JesusFreke/smali
to create a patch/diff of this particular code change between a modified and unmodified (nonfunctional) binary app built from source - reflecting the corresponding changes in bytecode. (Although apktool could probably be used to do the same)
This bytecode patch can then be applied to the precompiled and fully functional production app as well, also using smali/backsmali (or apktool)

ClassNotFoundException: Didn't find class "com.xxx.xxx.Application" on path: DexPathList on Linux

I've moved from Mac to a linux machine (ubuntu) and and can't get the previous project running. The project has about 10 modules, and it still works fine on my macbook, but when building on ubuntu (tried clean install on 17.10 2 times, and 16.04 2 times as well) will crash the app on start with the following error:
E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate application com.xxx.xxx.Application: java.lang.ClassNotFoundException: Didn't find class "com.xxx.xxx.Application" on path: DexPathList[[zip file "/data/app/com.xxx.xxx.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xxx.xxx.debug-1/lib/arm, /data/app/com.xxx.xxx.debug-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at android.app.LoadedApk.makeApplication(LoadedApk.java:802)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5418)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1558)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6165)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.xxx.xxx.Application" on path: DexPathList[[zip file "/data/app/com.xxx.xxx.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xxx.xxx.debug-1/lib/arm, /data/app/com.xxx.xxx.debug-1/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at android.app.Instrumentation.newApplication(Instrumentation.java:1014)
at android.app.LoadedApk.makeApplication(LoadedApk.java:796)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5418) 
at android.app.ActivityThread.-wrap2(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1558) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6165) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778) 
I've tried cleaning, rebuilding, invalidating and restarting, 3 different android studio versions (the stable one, 2.3, and latest canary build) on both operating systems (17.10 and 16.04) and I still get exactly same error. Also, I've installed the libraries for 64 bit system. Also, I've tried with oracle java as well.
Does anyone have any clue why a project gets this error on linux but not on mac?
Update
So I found out that Ubuntu does not see the application class. It has a red label and is not recognized from the manifest file. This is the application class from app package and I can only see it if I switch to project view. I'm currently investigating why it doesn't see it.
So the problem was that Ubuntu would not see the Application class, and thus did not consider it on build, as a result it wasn't included in dex files. The thing is that the application class is inside app -> src -> main -> Java -> packagename -> Application.class , and Ubuntu did not recognize Java as a valid directory. It recognizes it only if it is java. So renaming the folder Java to java has fixed the problem and the application class is now visible.
Morale 1: Always triple check all ridiculous use cases and pay attention to details.
Morale 2: Ubuntu handles folders in a different manner than Mac because Mac couldn't care less if that's capital J or lowercase j.
Do one thing disable Instant Run feature.
you can do it by
File->Settings->Build,Execution,Deployment->Instant run
Click on instant run and then disable the checkbox for Instant Run.

My app crashes on launch?

I apologize for the broad title but I struggle to be more specific because iIhonestly don't know what went wrong. I was working on my app just like normal, and I hadn't tested for a couple of hours and also I think I updated something in android studio (It prompted me that some features were ready to be updated and I clicked)
Anyways, I've reverted everything I could think of that I might have screwed up, but it still won't work. I figure it might be something in the gradle files. Is anyone able to figure it out based on this?
--------- beginning of crash
10-24 14:10:47.679 2597-2597/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.jonet.lillehauaapp, PID: 2597
java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.jonet.lillehauaapp-a1apOVe4GHJGjXWwg52Lag==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.jonet.lillehauaapp-a1apOVe4GHJGjXWwg52Lag==/lib/x86, /system/lib, /system/vendor/lib]]] couldn't find "libnative-lib.so"
at java.lang.Runtime.loadLibrary0(Runtime.java:1011)
at java.lang.System.loadLibrary(System.java:1657)
at com.example.jonet.lillehauaapp.MainActivity.<clinit>(MainActivity.java:25)
at java.lang.Class.newInstance(Native Method)

Can't find the dependent library for mavenized JCUDA in Eclipse

I am trying to setup mavenized JCUDA for a project that I am working on and am running into issues with telling java where to locate the library files.
Setting up and getting maven to build the .jar and .dll files has worked fine, I can see the correctly named .dll files in project\target\lib and I am setting my native library location to this folder.
The error I get when trying to run one of the programs from JCUDA JCublasSample.java (www.jcuda.org/samples/JCublasSample.java) is:
Creating input data... Performing Sgemm with Java... Performing Sgemm
with JCublas...
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not
load the native library.
Error while loading native library "JCublas-windows-x86_64" with base
name "JCublas" Operating system name: Windows 7 Architecture :
amd64 Architecture bit size: 64
Stack trace from the attempt to load the library as a resource:
java.lang.NullPointerException: No resource found with name
'/lib/JCublas-windows-x86_64.dll'
at jcuda.LibUtils.loadLibraryResource(LibUtils.java:149) at
jcuda.LibUtils.loadLibrary(LibUtils.java:83) at
jcuda.jcublas.JCublas.initialize(JCublas.java:93) at
jcuda.jcublas.JCublas.(JCublas.java:81) at
JCublasSample.sgemmJCublas(JCublasSample.java:64) at
JCublasSample.testSgemm(JCublasSample.java:49) at
JCublasSample.main(JCublasSample.java:25)
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError:
C:\Users\kristoffer.bernhem\git\SMlocalizer\target\lib\JCublas-windows-x86_64.dll:
Can't find dependent libraries
at java.lang.ClassLoader$NativeLibrary.load(Native Method) at
java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941) at
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857) at
java.lang.Runtime.loadLibrary0(Runtime.java:870) at
java.lang.System.loadLibrary(System.java:1122) at
jcuda.LibUtils.loadLibrary(LibUtils.java:94) at
jcuda.jcublas.JCublas.initialize(JCublas.java:93) at
jcuda.jcublas.JCublas.(JCublas.java:81) at
JCublasSample.sgemmJCublas(JCublasSample.java:64) at
JCublasSample.testSgemm(JCublasSample.java:49) at
JCublasSample.main(JCublasSample.java:25) at
jcuda.LibUtils.loadLibrary(LibUtils.java:128) at
jcuda.jcublas.JCublas.initialize(JCublas.java:93) at
jcuda.jcublas.JCublas.(JCublas.java:81) at
JCublasSample.sgemmJCublas(JCublasSample.java:64) at
JCublasSample.testSgemm(JCublasSample.java:49) at
JCublasSample.main(JCublasSample.java:25)
As explained by Guenther, the problem lies in supporting .dll files that are lacking. How would I go about sorting this error out?
This is being run in windows 7 (64bit) and run with JDK1.8.0_91.

RoboGuice Proguard CreationException

I'm using Roboguice 3.0.1 with RoboBlender 3.0.1. I've read the wiki. This application has been working perfectly since 3.0.1 has been GA (almost a year), and I just added proguard to my project. I've seemingly setup the proguard configuration correctly.
Anytime I run the application, I get this error immediately (this is all that is printed; no stack trace or anything).
11-24 01:36:05.473 12995-12995/com.me D/roboguice.RoboGuice: Using annotation database(s).
11-24 01:36:05.475 12995-12995/com.me D/roboguice.RoboGuice: Using annotation database(s) : [com.me, roboguice]
11-24 01:36:05.485 12995-12995/com.meD/roboguice.RoboGuice: Time spent loading annotation databases : 8
11-24 01:36:05.822 12995-12995/com.me E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.me, PID: <pid>
java.lang.RuntimeException: Unable to create application com.me.MeApplication: com.google.inject.CreationException: Unable to create injector, see the following errors:
Note: I've posted this as an issue in the RoboGuice repo, but since that place looks dead, I figured I'd be more likely to get help here.
Looks like it's an issue with Guice. There was an error at this line, but no error was printed.
Guice Issue

Categories