why Android App is crashing with UnsatisfiedLinkError? - java

I created a react-native app and published it yesterday. The app is crashing whenever I try to open it on a real device but is is working in a simulator(using android studio). I collected a user sent crash report it is showing me this error. I am a beginner in android development and I don't know java.
I used android app bundle.
Can anyone help me to diagnose the error and what could I do to get more information regarding this and also how can I fix it.
java.lang.UnsatisfiedLinkError:
at com.facebook.soloader.SoLoader.loadLibraryBySoName (SoLoader.java:314)
at com.facebook.soloader.SoLoader.loadLibrary (SoLoader.java:247)
at com.facebook.react.bridge.ReactBridge.staticInit (ReactBridge.java:18)
at com.facebook.react.bridge.NativeMap.<clinit> (NativeMap.java:19)
at com.facebook.react.bridge.JSCJavaScriptExecutorFactory.create (JSCJavaScriptExecutorFactory.java:21)
at com.facebook.react.ReactInstanceManager$5.run (ReactInstanceManager.java:912)
at java.lang.Thread.run (Thread.java:764)
I solved one issue after adding this into the build.gradle file. But now It is showing me an older version of the app and also dependency graph is not loaded. It is stuck. Help
ndk {
abiFilters "armeabi-v7a", "x86", 'armeabi', 'arm64-v8a'
}
packagingOptions {
exclude "lib/arm64-v8a/libgnustl_shared.so"
exclude '/lib/mips64/**'
exclude '/lib/arm64-v8a/**'
exclude '/lib/x86_64/**'
}

You have to upgrade the react-native version to 0.59 for supporting 64-bit native libs. http://facebook.github.io/react-native/blog/2019/03/12/releasing-react-native-059

Related

How to access aar file, in libs, from Main

I spent the last three days trying to read an .aar in Android Studio and I just can't figure it out.
My project view looks like this:
--- AnApplication
----------------------.gradle
-----------------------.idea
----------------------- app
-------------------------------- build
-------------------------------- libs
---------------------------------------- cube5-debug.aar
(...)
I want to access a class inside cube5-debug.aar from my main activity.
I know the class is there in the .aar file.
I don't know the precise import line I must write at the start of my main.
I have tried import com.company_cube.cube5 (the package of the project where I generated my .aar) and many other variants.
I don't know if Android Studio is recognizing the file as a library. However, the files sync with the gradle successfully.
(For context, the project where I generated the .aar was made by Unity, by exporting a Unity project into an Android one, and then generating the .aar from that one; the goal was to use this .aar file as a library in a second Android Studio project - the one I am talking about in this post)
I am patiently waiting for any help you can give me. Thanks
EDIT: To import the .aar, I followed the images of this small post:
Importing .aar in android Studio
And solved the error the post reports by putting the .aar in the libs folder like Daniel Nugent said. However, when I try to write, in the Main:
Intent intent = new Intent(getApplicationContext(),UnityPlayerActivity.class);
AS doesn't recognize UnitPlayerActivity. This class is inside the .aar file supposedly. Before making the aar in my first AS project, it was here:
cube5->libs->unity-classes.jar->com.unity3d.player->UnityPlayerActivity
When I open the .aar with Winrar, and open unity-classes.jar with a text editor, I see a almost everything as encoded symbols.
I'm not sure it is normal. Any idea?
EDIT 2: I think I know where the error is: when I import my .aar, I get an IDE fatal error. I don't know how to solve it, so if you can, please check the post I made about it:
IDE fatal error on importing .aar
For android Studio 2.3.3 you can use
repositories {
flatDir {
dirs 'libs' //this way we can find the .aar file in libs folder
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile(name: 'cube5-debug', ext: 'aar')
}
in the app level build.gradle. I did't check it for AS 3.0.
Add .aar file to your app by doing:
in project build.gradle
allprojects {
repositories {
flatDir {
dirs 'libs'
}
}
}
in app build.gradle
dependencies {
compile(name:'cube5-debug', ext:'aar')
}
So I managed to solve it. The .aar file I talked about was exported with AS, after I imported an Unity project into AS. I did this in order to use the Unity program inside AS. However, this gives error for some versions of Unity and AS. I installed Unity 5.5.0f3 and an older version of AS, and everything worked fine.
Note1: if you aim to install that Unity version, you will be prompted with a requirement of some windows 10 tool, which you must get (I cannot remember the name). I did it by downloading windows 10 install and installing only that tool, which comes with the package.
Note2: I made the program from Unity work inside AS but only because it was a simple program. I later wanted to do an Augmented Reality App in Unity, and use it in AS, but it cannot be done apparently. Evertyting works fine until I import the .aar into AS, and a class in that .aar library gets unresolved ("Video player”). This should have to do with the AR camera class, which AS does not recognize. I ended up creating a AR app with Unity, another app in AS, and from the AS app, calling the Unity app with two lines of code, whenever necessary. To return to the AS app, now in background, I simple click the back button, which is recognized by the Unity app (if you make code in Unity for it) and makes it destroy itself, returning to the AS app.

Android ReactNative java.lang.UnsatisfiedLinkError:could find DSO to load: libreactnativejni.so

I have been trying to add ReactNative to my existing android application. I followed the instructions from this link. I could add it but the app gets crashed once I open the react native activity. I have started server using
adb reverse tcp:8081 tcp:8081
and started react-native using
react-native start
I get a dialogue that the js files are loading. But finally end up with a crash. Following is the error that is being printed in logcat:
java.lang.UnsatisfiedLinkError: couldn't find DSO to load: libreactnativejni.so
at com.facebook.soloader.SoLoader.loadLibraryBySoName(SoLoader.java:213)
at com.facebook.soloader.SoLoader.loadLibrary(SoLoader.java:178)
at com.facebook.react.bridge.JSCJavaScriptExecutor.<clinit>(JSCJavaScriptExecutor.java:19)
at com.facebook.react.ReactInstanceManager.onJSBundleLoadedFromServer(ReactInstanceManager.java:413)
at com.facebook.react.ReactInstanceManager.createReactContextInBackground(ReactInstanceManager.java:236)
I am completely lost as I am unable to figure out the cause for this issue.
Thanks in advance.
actually in my case these steps worked:
uninstall the app from the device
close Metro Bundler
run ./gradlew clean on android directory
run react-native run-android
hope to help you.
This has fixed my issue :
ndk {
abiFilters 'armeabi-v7a', 'x86'
}
This should be placed build.gradle defaultConfig section.
This is caused by the following issue (open for 2 years) https://github.com/facebook/react-native/issues/2814
From the issue:
React Native on Android doesn't provide a 64-bit version of the libreactnativejni.so native library, which can cause compatibility issues on 64-bit devices. I ran into this while attempting to integrate React Native with a large existing application I'm developing.
Reaction from Facebook:
"Thanks for reporting! Yes we don't provide 64-bit version of the native code and the system should always fall back to 32-bit."
And:
"Most Android projects use a number of 3rd-party libraries, and any that include native 64-bit code will cause React Native to fail."
The following SO answer Use 32-bit jni libraries on 64-bit android explains fallback to 32-bit libraries and the fact you cannot mix. So if 64-bit is found, all should be 64-bit
I suggest reading along the Github issue #2814. There are multiple fixes proposed, but it depends on your situation what works.
The issuer has also written a blog about it: Mixing 32- and 64-bit Dependencies in Android
Hope this helps!
To me what worked was to clean project build and build it again.
Solution 1:
follow these steps:
uninstall the app from the device
close Metro Bundler
run ./gradlew clean on android directory
run react-native run-android
hope to help you.
Solution 2:
you can use the old version of soloader by adding configurations.all into your build.gradle
configurations.all {
resolutionStrategy {
force "com.facebook.soloader:soloader:0.8.2"
}
}
like this
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
configurations.all {
resolutionStrategy {
force "com.facebook.soloader:soloader:0.8.2"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
reference
https://stackoverflow.com/a/61695629/8079868
I solved this issue, update fresco library that is support for app bundle is 2.0.0 below this will not support,
Update: For me the issue got solved after updating fresco to 2.0.0, because 1.11.0 apparently didn't have support for Android App Bundles. I don't know if you all had the same problem, though.
just do this :
implementation 'com.facebook.fresco:fresco:2.0.0'
I had the same issue when running on Android 30. Following addition to the android/build.gradle file worked for me:
configurations.all {
resolutionStrategy {
// use 0.9.0 to fix crash on Android 11
force "com.facebook.soloader:soloader:0.9.0"
}
}
Credits
This worked for me,
cd android
./gradlew clean
It might be lib\x86_64\libreactnativejni.so not found due to missing strip tool for ABI 'X86_64'
Try the following steps.
Uninstall the apk
Clean the android folder
Navigate to android folder cd android.
Clean the directory using
gradle
For Windows, gradlew clean
For Linux, ./graldew clean
Now you can try react-native run-android --no-jetifier
Step 1: Goto Android Studio -> Build -> clean project.
Step 2: delete the project in your device.
Step 3: run react-native start.
Step 4: run npx react-native run-android.
It's working for me, no need of any gradle related changes.
if you are fresco libray then make sure use latest version and set the properties as false :
shrinkResources false
minifyEnabled false
Inside build.gradle file.

Android Studio - Gradle 1.5 --core-library option

I have a problem with my Android project and Gradle 1.5.
I am not able to compile my dependencies I added. Currently I am developing an Java EE application and I want to perform an EJB lookup from my Android device to my running Wildfly10.
I know, doing a lookup from an android device might not be the best option, a REST webservice would be better, but thats not the point here.
In my project I added a new module, containing all my external libs, and I added this module to my :app as dependency on "compile" level. Everything just works fine, until I want to add the jboss-client.jar. During dex, he is complaining about the javax.transaction.*.
What I have done for now
added multiDexEnabled true
added preDexLibraries false
playing around with all other dex options
also I tried this: Android dx tool
this: Android Studio ignore --core-library flag
and set the --core-library flag in Android Studio settings
Why they are not working
solution: I modified my dx.bat in every build-tool I have .. nothing changed. It's just not working
solution: com.android.build.gradle.tasks.Dex is not known (and I have no idea how to add), coreLibrary is not supported with Gradle 1.5
solution: is completely ignored by gradle
The projects minSDK is 19 and targetSDK is 23 with build-tool 23.0.2
I called the dx.bat from command-line with the same parameters as gradle, I only added the --core-library arg and it works! But that doesnt solve the problem within Android Studio and Gradle.
Can anyone please help me?
UPDATE:
Okay, I had a look at the source code of com.android.dx.command.Main. There is a public inner class "Arguments" which contains (apperently) the arguments which can be used, also the coreLibrary=false. Now I only need to know how to modify it. Does anybody know?
Best regards,
Chris
This worked for me:
dexOptions {
preDexLibraries = false
additionalParameters =["--core-library"]
}

Google Maps v2 in the Android Studio. Not found GeoPoint

I am working on a code that was made in the Eclipse and i am migrating to Android Studio, however i am having a problem to the to import
com.google.android.maps.GeoPoint;
but i can import
com.google.android.gms.maps.GoogleMap;
I've tried to add in my Gradle file
compile 'com.google.android.gms:play-services:6.5.87'
and also i've tried also to use .jar, however i didn't have good results.
compile files('libs/google-play-services.jar')
I searched about this in many places, but i found nothing to help me, case somebody have resolved this problem and want help me i thank you.
To work, i had that to replace the below line in the my Gradle file.
android {
...
compileSdkVersion 16
...
}
To
android {
...
compileSdkVersion "Google Inc.:Google APIs:16"
...
}
Please following all the steps to Add Google Play Services to Your Project in Android Studio:
1.Open the build.gradle file inside your application module directory.
Note: Android Studio projects contain a top-level build.gradle file and a build.gradle file for each module. Be sure to edit the file for your application module. See Building Your Project with Gradle for more information about Gradle.
2.Add a new build rule under dependencies for the latest version of play-services. For example:
apply plugin: 'com.android.application'
...
dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
}
Be sure you update this version number each time Google Play services is updated.
Note: If the number of method references in your app exceeds the 65K limit, your app may fail to compile. You may be able to mitigate this problem when compiling your app by specifying only the specific Google Play services APIs your app uses, instead of all of them. For information on how to do this, see Selectively compiling APIs into your executable.
3.Save the changes and click Sync Project with Gradle Files in the toolbar.
4.Open your app's manifest file and add the following tag as a child of the element:
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
You can now begin developing features with the Google Play services APIs.
Please refer to here for more details.

Libgdx & RoboVM to app store

I can compile and run my game using LibGDX 0.9.9 and RoboVM 0.0.7
I have been able to build an ipa for app store submission. Uploading my app with Application Loader, I get an error saying: This bundle is invalid. Apple is currently not accepting applications built with this version of Xcode.
Adding
<key>DTXcode</key>
<string>0502</string>
<key>DTXcodeBuild</key>
<string>5A3005</string>
to my info.plist, I get the same app store submission error.
I have tried compiling my project with every combination of the following libraries
LibGDX 0.9.9
LibGDX Nightly - 02/13/14
RoboVM 0.0.8
RoboVM 0.0.9
RoboVM 0.0.10-SNAPSHOT
With any version of RoboVM greater than 0.0.7, I get the following error:
java.lang.IllegalArgumentException: No #Marshaler found for parameter 1 of #Callback method <com.badlogic.gdx.backends.iosrobovm.objectal.AVAudioPlayerDelegate$Callbacks: void didFinishPlaying(com.badlogic.gdx.backends.iosrobovm.objectal.AVAudioPlayerDelegate,org.robovm.objc.Selector,org.robovm.cocoatouch.foundation.NSObject,boolean)>
at org.robovm.compiler.MarshalerLookup.findMarshalerMethod(MarshalerLookup.java:167)
at org.robovm.compiler.BroMethodCompiler.getParameterType(BroMethodCompiler.java:492)
at org.robovm.compiler.BroMethodCompiler.getBridgeOrCallbackFunctionType(BroMethodCompiler.java:513)
at org.robovm.compiler.BroMethodCompiler.getCallbackFunctionType(BroMethodCompiler.java:505)
at org.robovm.compiler.CallbackMethodCompiler.callback(CallbackMethodCompiler.java:78)
at org.robovm.compiler.CallbackMethodCompiler.compileCallback(CallbackMethodCompiler.java:107)
at org.robovm.compiler.CallbackMethodCompiler.doCompile(CallbackMethodCompiler.java:74)
at org.robovm.compiler.AbstractMethodCompiler.compile(AbstractMethodCompiler.java:74)
at org.robovm.compiler.ClassCompiler.callbackMethod(ClassCompiler.java:1070)
at org.robovm.compiler.ClassCompiler.compile(ClassCompiler.java:566)
at org.robovm.compiler.ClassCompiler.compile(ClassCompiler.java:283)
at org.robovm.compiler.AppCompiler.compile(AppCompiler.java:198)
at org.robovm.compiler.AppCompiler.compile(AppCompiler.java:216)
at org.robovm.compiler.AppCompiler.main(AppCompiler.java:438)
I'm at a loss. I just want to submit my app to the Apple App Store. RoboVM 0.0.7 doesn't seem to work and I can't compile my project with any newer version of RoboVM. Let me know if you need any more information.
How can I submit my app using RoboVM 0.0.7 (emulate Xcode 5.2)?
or
How can I fix my error and compile with >0.0.7?
The bundle is invalid problem was fixed in RoboVM 0.0.9 so you must use at least that version. The cause of the No #Marshaler found error is probably because you have an old version of robovm-cocoatouch.jar in your classpath somewhere. Make sure you only have jars from RoboVM 0.0.9 in your Eclipse classpath.

Categories

Resources