My app crashes on launch? - java

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)

Related

Java.Lang.UnsatisfiedLinkError:'dlopen failed: library "/system/lib/libmifare7003plus.so" needed [duplicate]

I want to import below libraries in my Android Studio Project these are placed in /system/lib64/ folder.
I am getting below error
2020-01-06 13:23:31.358 5171-5171/org.strongswan.android E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.strongswan.android, PID: 5171
java.lang.UnsatisfiedLinkError: dlopen failed: library "/system/lib64/libstrongswan.so" needed or dlopened by "/system/lib64/libnativeloader.so" is not accessible for the namespace "classloader-namespace"
at java.lang.Runtime.loadLibrary0(Runtime.java:1016)
at java.lang.System.loadLibrary(System.java:1669)
at org.strongswan.android.logic.CharonVpnService.<init>(CharonVpnService.java:730)
at java.lang.Class.newInstance(Native Method)
at android.app.AppComponentFactory.instantiateService(AppComponentFactory.java:103)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:3740)
at android.app.ActivityThread.access$1400(ActivityThread.java:238)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1803)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7073)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)
on the line System.loadLibrary("strongswan")
System.loadLibrary("strongswan");
if (MainActivity.USE_BYOD)
{
System.loadLibrary("tncif");
System.loadLibrary("tnccs");
System.loadLibrary("imcv");
}
System.loadLibrary("hydra");
System.loadLibrary("charon");
System.loadLibrary("ipsec");
System.loadLibrary("androidbridge");
}
From Nougat onwards, Android prevents the runtime linkage of private symbols from system libraries (see this blogpost in Android Developers).
You have two options:
Include those libraries in your APK so that you don't need to look for them in /system/lib/; or
Modify your Android ROM so that those libraries are considered public. This can be done by adding those libraries to /system/etc/public.libraries.txt.
I also meet this error.The situation I tested is like this.
I put the so file in the [libs/yourCpuModel(armeabi-v7a)/] directory will be this error.
I put the so file in the [src/jniLibs/youtCpuModel(armeabi-v7a)/] directory will be this error.
But I put the so file in the [src/main/jniLibs/yourCpuModel(armeabi-v7a)/] directory will not.
I don't know why.Maybe you can try it.

Hello, I have a problem trying to port a certain OEM android app

I'm trying to port LG system launcher but I can't get it to work due to a certain missing class called "LGSharedPreferences" or something like that. Here is the logcat obtained:
FATAL EXCEPTION: main
Process: com.lge.launcher3, PID: 9174
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/app/LGSharedPreferences;
at com.lge.launcher3.util.LGHomeFeature.getPermanentPreferences(LGHomeFeature.java:416)
at com.lge.launcher3.util.LGHomeFeature.getSwivelHomeStateFromPreferences(LGHomeFeature.java:369)
at com.lge.launcher3.util.LGHomeFeature.<init>(LGHomeFeature.java:278)
at com.lge.launcher3.util.LGHomeFeature.init(LGHomeFeature.java:294)
at com.lge.launcher3.allapps.SwivelAllAppsDBProvider.onCreate(SwivelAllAppsDBProvider.java:28)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2388)
at android.content.ContentProvider.attachInfo(ContentProvider.java:2358)
at android.app.ActivityThread.installProvider(ActivityThread.java:7248)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:6789)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6706)
at android.app.ActivityThread.access$1300(ActivityThread.java:238)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1914)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7666)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.ClassNotFoundException: android.app.LGSharedPreferences
... 18 more
If it helps I tried both installing it as a user app and making a magisk module to install it as a system app (also I bundled with it some libraries I found in the app manifest such as "com.lge.sui" and "com.lge.lgdynamicactionbar" but no luck) and I always get the same error, some help will be highly appreciated 👍
By the way, sorry for my bad English, I'm still learning :)
The error message means that android.app.LGSharedPreferences was available at compile time, but is missing at runtime. Given the package name of the class, my guess would be that the class is supposed to be loaded from the OS on LG phones, and you are running the app on a phone that doesn't have that available.
If you have the source code for the app and the library that contains android.app.LGSharedPreferences, you should make sure the library containing LGSharedPreferences is statically compiled in (probably also change the package name to avoid conflicts on LG phones).

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.

Eclipse Java - Android app using serial do not work

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.

library "libmaliinstr.so" not found.... in eclipse

please help me. my Android application is an Alarm application that play on time in many Android devices, but my code has been error when played in some devices like Huawei Honor C3. the error is:
09-26 18:17:19.119: E/linker(23841): load_library(linker.cpp:759): library "libmaliinstr.so" not found
09-26 18:17:19.121: E/(23841): appName=com.behroid.intelligentalarm, acAppName=com.android.cts.openglperf
09-26 18:17:19.121: E/(23841): 0
09-26 18:17:19.121: E/(23841): appName=com.behroid.intelligentalarm, acAppName=com.android.browser
please give me some solution...
I guess some of the devices have missing library files. The same happened to me with opencl.so.
In that particular case I found the opencl.so file on the device and had to do a symlink opencl.so.1 to that particular apps appdata.(In the appdata folder in the root directory).

Categories