My app was working fine, until it crashed once and can't run again only on android. IOS is working fine.
build doesn't catch any error, but when I start it on android studio I get these error log.
enter image description here
E/unknown:ReactNative: ReactInstanceManager.createReactContext: mJSIModulePackage not null
E/AndroidRuntime: FATAL EXCEPTION: mqt_js
Process: com.gamo, PID: 17096
java.lang.AssertionError: No source URL loaded, have you initialised the instance?
at com.facebook.infer.annotation.Assertions.assertNotNull(Assertions.java:35)
at com.facebook.react.modules.debug.SourceCodeModule.getTypedExportedConstants(SourceCodeModule.java:39)
at com.facebook.fbreact.specs.NativeSourceCodeSpec.getConstants(NativeSourceCodeSpec.java:35)
at com.facebook.react.bridge.JavaModuleWrapper.getConstants(JavaModuleWrapper.java:129)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
at android.os.Looper.loop(Looper.java:223)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
at java.lang.Thread.run(Thread.java:923)
I/Process: Sending signal. PID: 17096 SIG: 9
I already tried gradlew clean, cache clean, enable hermes = true
After a recent commit, my app started crashing on marshmallow. I added a custom class, NormalMode, which is created when a service is started. The bug only occurs when this service is started.
I tried looking into the 65K limit and tried to used multidex, but it didn't make a difference. I also installed a plugin to tell me how many methods I use, it found 54996 methods.
Here is a sample of the logcat, running an emulator:
02-15 18:00:44.428 8783-8783/com.vivescere.beacon I/art: Rejecting re-init on previously-failed class java.lang.Class<com.vivescere.beacon.emitter.mode.NormalMode>
02-15 18:00:44.429 8783-8783/com.vivescere.beacon D/AndroidRuntime: Shutting down VM
02-15 18:00:44.429 8783-8783/com.vivescere.beacon E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.vivescere.beacon, PID: 8783
java.lang.NoClassDefFoundError: com.vivescere.beacon.emitter.mode.NormalMode
at com.vivescere.beacon.emitter.EmitterService.switchMode(EmitterService.java:328)
at com.vivescere.beacon.emitter.EmitterService.start(EmitterService.java:289)
at com.vivescere.beacon.emitter.EmitterService.onStartCommand(EmitterService.java:163)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3010)
at android.app.ActivityThread.-wrap17(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1442)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
02-15 18:00:48.441 8783-8783/com.vivescere.beacon I/Process: Sending signal. PID: 8783 SIG: 9
I tried removing the class in question, but it just slows down the error, which now happens when creating an instance of the next custom class I have.
I know that there are a million other questions on OutOfMemoryError on SO. But my case is different. None of the lines in the stack trace is from my code or a library that I have included. Whole of the stack trace consists of Android's standard libraries.
I don't have any clue as to where I should start my debugging. Any ideas on how I should debug it further?
Fatal Exception: java.lang.OutOfMemoryError
at android.util.ArrayMap.allocArrays(ArrayMap.java:196)
at android.util.ArrayMap.ensureCapacity(ArrayMap.java:307)
at android.os.Bundle.unparcel(Bundle.java:247)
at android.os.Bundle.getSparseParcelableArray(Bundle.java:1273)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1207)
at android.support.v4.app.FragmentManagerImpl.moveFragmentsToInvisible(FragmentManager.java:2323)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2136)
at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2092)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1998)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:709)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5292)
at java.lang.reflect.Method.invokeNative(Method.java)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(NativeStart.java)
android/app/src/main/AndroidManifest.xml
<application
android:largeHeap="true"
Adding largeHeap might be fix it
I'm trying to modify this project from android studio 2 but when I try to run the app from Android 4.4.2 and connect to a bluetooth device, it gives these error messages.
06-02 14:51:30.126 12669-12669/com.example.ti.ble.sensortag E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.ti.ble.sensortag, PID: 12669
java.lang.IllegalArgumentException: null is not a valid Bluetooth address
at android.bluetooth.BluetoothDevice.<init>(BluetoothDevice.java:564)
at android.bluetooth.BluetoothAdapter.getRemoteDevice(BluetoothAdapter.java:418)
at com.example.ti.ble.common.BluetoothLeService.disconnect(BluetoothLeService.java:635)
at com.example.ti.ble.sensortag.MainActivity.onConnect(MainActivity.java:320)
at com.example.ti.ble.sensortag.MainActivity.onDeviceClick(MainActivity.java:379)
at com.example.ti.ble.sensortag.ScanView$1.onItemClick(ScanView.java:205)
at android.widget.AdapterView.performItemClick(AdapterView.java:299)
at android.widget.AbsListView.performItemClick(AbsListView.java:1152)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3014)
at android.widget.AbsListView$3.run(AbsListView.java:3865)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5341)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:825)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:641)
at dalvik.system.NativeStart.main(Native Method)
The project can be found here SensorTag20 Project. How do I fix these problems?
Turns out, I just needed to restart the device everytime I reprogram it.
Unfortunally a similar question was removed at Stackoverflow some weeks ago, I must make a new question.
Im trying to build an own Telegram app for android via source # https://github.com/DrKLO/Telegram
I can not get it to work, it stops on startup with the following error, any ideas on where to start, Im quite new to Android Studio.
11-17 19:55:04.142 2667-2667/org.telegram.messenger E/art: No implementation found for void org.telegram.tgnet.ConnectionsManager.native_setJava(boolean) (tried Java_org_telegram_tgnet_ConnectionsManager_native_1setJava and Java_org_telegram_tgnet_ConnectionsManager_native_1setJava__Z)
11-17 19:55:04.142 2667-2667/org.telegram.messenger D/AndroidRuntime: Shutting down VM
11-17 19:55:04.151 2667-2667/org.telegram.messenger E/AndroidRuntime: FATAL EXCEPTION: main
11-17 19:55:04.151 2667-2667/org.telegram.messenger E/AndroidRuntime: Process: org.telegram.messenger, PID: 2667
11-17 19:55:04.151 2667-2667/org.telegram.messenger E/AndroidRuntime: java.lang.UnsatisfiedLinkError: No implementation found for void org.telegram.tgnet.ConnectionsManager.native_setJava(boolean) (tried Java_org_telegram_tgnet_ConnectionsManager_native_1setJava and Java_org_telegram_tgnet_ConnectionsManager_native_1setJava__Z)
11-17 19:55:04.151 2667-2667/org.telegram.messenger E/AndroidRuntime: at org.telegram.tgnet.ConnectionsManager.native_setJava(Native Method)
11-17 19:55:04.151 2667-2667/org.telegram.messenger E/AndroidRuntime: at org.telegram.messenger.ApplicationLoader.onCreate(ApplicationLoader.java:259)
11-17 19:55:04.151 2667-2667/org.telegram.messenger E/AndroidRuntime: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1013)
11-17 19:55:04.151 2667-2667/org.telegram.messenger E/AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4707)
11-17 19:55:04.151 2667-2667/org.telegram.messenger E/AndroidRuntime: at android.app.ActivityThread.-wrap1(ActivityThread.java)
11-17 19:55:04.151 2667-2667/org.telegram.messenger E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1405)
11-17 19:55:04.151 2667-2667/org.telegram.messenger E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
11-17 19:55:04.151 2667-2667/org.telegram.messenger E/AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
11-17 19:55:04.151 2667-2667/org.telegram.messenger E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)
11-17 19:55:04.151 2667-2667/org.telegram.messenger E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
11-17 19:55:04.151 2667-2667/org.telegram.messenger E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-17 19:55:04.151 2667-2667/org.telegram.messenger E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
The main problem is that you're running the project without generating the native library from the C/C++ codes. Because of that project based on Telegram, which you point it out with the link, has the file Android.mk on the jni directory , you have to compile the code manually. I fixed that exception following these steps:
Check that build.gradle contains:
source version 3.13.1 and newer:
sourceSets.main.jniLibs.srcDirs = ['./jni/']
source version lower than 3.13.1:
sourceSets.main {
jniLibs.srcDirs = 'libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
Download the NDK
Proceed according to your operating system.
Linux / Mac
$ cd <path-to-Telegram>/TMessagesProj
$ <path-to-ndk>/ndk-build
Windows
Download Cygwin
Add on .bashrc file, which is placed on Cygwin root directory (use some utility to find that file). In my case, the file was placed in C:\cygwin64\home\myuser.
export ndkbuild=/cygdrive/partition_name/your_ndk_directory/ndk-build.cmd
Open the Cygwin terminal and move yourself towards the jni directory of the project:
cd /cygdrive/your_partition_name/project_jni_directory_path
Write $ndkbuild and wait the compiler finishes its task. If this process is right, two directories will show up, obj and libs. Check that libs directory contains some library with .so extension. Finally, run the project.
As Jesús Castro mentioned, you have to compile native codes to libraries with .so suffix that android can use them for running app.
But why this is happened newly? Because in the last commit of DrKLO's Telegram repository they have removed the prebuilt libraries according to commit message in git:
Removing prebuilt libraries. The source code for all libraries is (and always was) available here: https://github.com/DrKLO/Telegram/tree/master/TMessagesProj/jni
You can find the commit here.
So, to solve your issue, you can remove your 64-bit libs from your build, or set abiFilters to package only 32-bit architectures:
android {
....
defaultConfig {
....
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
}
}
add android.useDeprecatedNdk=true to a file named gradle.properties at the root of your project
#Rajsundar . If adding the line :
export ndkbuild=/cygdrive/c/android-ndk-r10e/ndk-build.cmd
is not working. After doing everything else you can simply run the command directly from the jni directory.
/cygdrive/c/android-ndk-r10e/ndk-build.cmd
I had a similar error message. The solution for me was to deinstall the app from the simulator, clean the project (including all libraries) and do a rebuild. Now the app starts fine.