enter image description here
I am creating a chat in android studio, when I run the program everything comes up with green chekes, but in the log I get the following error and send me to correct the problem in the Main Activity, in the emoludar opens the application and closes it.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: mensajeria.chatappsistema, PID: 11008
java.lang.RuntimeException: Unable to start activity ComponentInfo{mensajeria.chatappsistema/mensajeria.chatappsistema.MainActivity}: java.lang.ClassCastException: android.support.v7.app.AlertController$RecycleListView cannot be cast to android.support.v7.widget.RecyclerView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.ClassCastException: android.support.v7.app.AlertController$RecycleListView cannot be cast to android.support.v7.widget.RecyclerView
at mensajeria.chatappsistema.MainActivity.onCreate(MainActivity.java:38)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE
E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE
E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE
Application terminated.
In XML file you are using different recyclerview and java you are casting different recyclerview that's why the error is coming. Use the same type of recyclerview in both XML and java file.
Related
I was working on a project which used exclusively strings literals in the code and layout, so I extracted them to strings.xml to later localize. Unfortunately after extracting all the strings and when trying to run I get a runtime error:
2020-06-16 13:54:20.482 22717-22717/com.Applikation.OReels.android E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.Applikation.OReels.android, PID: 22717
java.lang.RuntimeException: Unable to create application com.Applikation.progressplay.Android.ProgressPlayApplication: android.content.res.Resources$NotFoundException: String resource ID #0x7f0f0062
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5743)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x7f0f0062
at android.content.res.Resources.getText(Resources.java:339)
at android.content.res.Resources.getString(Resources.java:433)
at com.Applikation.progressplay.Android.Shared.DataManager.DataManager.createServerMessage(DataManager.kt:183)
at com.Applikation.progressplay.Android.Shared.DataManager.DataManager.<init>(DataManager.kt:33)
at com.Applikation.progressplay.Android.Shared.DataManager.DataManager$Companion.shared(DataManager.kt:45)
at com.Applikation.progressplay.Android.ProgressPlayApplication.onCreate(ProgressPlayApplication.kt:22)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740)
at android.app.ActivityThread.-wrap1(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
DataManager.kt Line 183:
serverErrors.put("em_DailyDepositLimitIsBelowZero" , Resources.getSystem().getString(R.string.daily_deposit_limit))
Any help or advice would be welcome.
Simply use getString() instead of Resources.getSystem().getString()
I make a simple app, that uses http. For debug previously I used Chuck library. But now, when I try to open http-package from Chuck I get exception and I don't understand why.
You can see the project here: https://github.com/FirstSpectr/Sandbox
Process: ru.spectr.kotlinsandbox, PID: 4699
java.lang.IncompatibleClassChangeError: Class 'com.readystatesoftware.chuck.internal.ui.TransactionActivity' does not implement interface 'androidx.lifecycle.LifecycleOwner' in call to 'androidx.lifecycle.Lifecycle androidx.lifecycle.LifecycleOwner.getLifecycle()' (declaration of 'androidx.lifecycle.LiveData' appears in /data/app/ru.spectr.kotlinsandbox-cFhy1fESF3ecXGlmQrM-Yg==/base.apk!classes2.dex)
at androidx.lifecycle.LiveData.observe(LiveData.java:172)
at androidx.loader.app.LoaderManagerImpl$LoaderInfo.setCallback(LoaderManagerImpl.java:100)
at androidx.loader.app.LoaderManagerImpl.createAndInstallLoader(LoaderManagerImpl.java:400)
at androidx.loader.app.LoaderManagerImpl.initLoader(LoaderManagerImpl.java:421)
at com.readystatesoftware.chuck.internal.ui.TransactionActivity.onCreate(TransactionActivity.java:91)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)```
I found problem dependency:
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02'
After deleted chuck work fine
I have added an external library from .jar in my project and whenever I run the the app, it throws this error :
FATAL EXCEPTION: main
Process: com.enginious.snowblossom, PID: 17643
java.lang.NoSuchMethodError: No static method decodeHex(Ljava/lang/String;)[B in class Lorg/apache/commons/codec/binary/Hex; or its super classes (declaration of 'org.apache.commons.codec.binary.Hex' appears in /system/framework/org.apache.http.legacy.boot.jar)
at snowblossom.lib.SnowFieldInfo.(SnowFieldInfo.java:28)
at snowblossom.lib.NetworkParamsTestnet.genSnowFields(NetworkParamsTestnet.java:32)
at snowblossom.lib.NetworkParams.(NetworkParams.java:22)
at snowblossom.lib.NetworkParamsTestnet.(NetworkParamsTestnet.java:13)
at snowblossom.lib.NetworkParams.loadFromConfig(NetworkParams.java:96)
at snowblossom.client.SnowBlossomClient.(SnowBlossomClient.java:281)
at com.enginious.snowblossom.MainActivity.onCreate(MainActivity.java:32)
at android.app.Activity.performCreate(Activity.java:7183)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1220)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2910)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3032)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6944)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
org.Appache.Commons is included in the library I have added but it is still throwing this error. I need guidance regarding this issue. Thanks.
I am new in the development of the AOSP environment. I'm trying to create a system service using the following url (sample source code)
http://devarea.com/aosp-creating-a-system-service,
I'm receiving a problem when I'm running the application:
Logcat error message:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.bojojnav.sampleserviceapp/com.example.bojojnav.sampleserviceapp.MainActivity}: java.lang.IllegalStateException: Failed to find ISampService by name [com.android.sampservice.ISampService]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.IllegalStateException: Failed to find ISampService by name [com.android.sampservice.ISampService]
at com.android.sampservice.SampManager.<init>(SampManager.java:43)
at com.android.sampservice.SampManager.getInstance(SampManager.java:18)
at com.example.bojojnav.sampleserviceapp.MainActivity.onCreate(MainActivity.java:16)
at android.app.Activity.performCreate(Activity.java:7009)
at android.app.Activity.performCreate(Activity.java:7000)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
please help me to resolve issue.
Since API 26 SensorDirectChannel is available to use for possible faster sample rates.
It can be used with MemoryFile or HardwareBuffer as Buffer.
I get IOExceptions with both while trying to create the Channel. I tried as following:
SensorManager sm = (SensorManager)getSystemService(Service.SENSOR_SERVICE);
MemoryFile memFile = null;
try {
memFile = new MemoryFile("AccMemoryFile", 1040);
} catch (Exception e) {
e.printStackTrace();
}
SensorDirectChannel channel = sm.createDirectChannel(memFile);
I get the following message:
02-26 15:15:46.477 10323-10323/de.makos.directchaneltest E/AndroidRuntime: FATAL EXCEPTION: main
Process: de.makos.directchaneltest, PID: 10323
java.lang.RuntimeException: Unable to start activity ComponentInfo{de.makos.directchaneltest/de.makos.directchaneltest.MainActivity}: java.io.UncheckedIOException: java.io.IOException: create MemoryFile direct channel failed -12
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.io.UncheckedIOException: java.io.IOException: create MemoryFile direct channel failed -12
at android.hardware.SystemSensorManager.createDirectChannelImpl(SystemSensorManager.java:587)
at android.hardware.SensorManager.createDirectChannel(SensorManager.java:904)
at de.makos.directchaneltest.MainActivity.onCreate(MainActivity.java:37)
at android.app.Activity.performCreate(Activity.java:7044)
at android.app.Activity.performCreate(Activity.java:7035)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.io.IOException: create MemoryFile direct channel failed -12
at android.hardware.SystemSensorManager.createDirectChannelImpl(SystemSensorManager.java:588)
at android.hardware.SensorManager.createDirectChannel(SensorManager.java:904)
at de.makos.directchaneltest.MainActivity.onCreate(MainActivity.java:37)
at android.app.Activity.performCreate(Activity.java:7044)
at android.app.Activity.performCreate(Activity.java:7035)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
With the HardwareBuffer I got a similar Exception.
Code:
HardwareBuffer accHawBuff = HardwareBuffer.create(1040, 1, HardwareBuffer.BLOB, 1, HardwareBuffer.USAGE_SENSOR_DIRECT_DATA);
SensorDirectChannel channel= sm.createDirectChannel(accHawBuff);
Exception Message:
02-26 15:27:07.592 10774-10774/de.makos.brakelightdatacollector E/AndroidRuntime: FATAL EXCEPTION: main
Process: de.makos.brakelightdatacollector, PID: 10774
java.lang.RuntimeException: Unable to start activity ComponentInfo{de.makos.brakelightdatacollector/de.makos.brakelightdatacollector.MainActivity}: java.io.UncheckedIOException: java.io.IOException: create HardwareBuffer direct channel failed -12
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.io.UncheckedIOException: java.io.IOException: create HardwareBuffer direct channel failed -12
at android.hardware.SystemSensorManager.createDirectChannelImpl(SystemSensorManager.java:612)
at android.hardware.SensorManager.createDirectChannel(SensorManager.java:927)
at de.makos.brakelightdatacollector.MesseinheitDirectChanel.registerListener(MesseinheitDirectChanel.java:63)
at de.makos.brakelightdatacollector.MainActivity.onCreate(MainActivity.java:64)
at android.app.Activity.performCreate(Activity.java:7044)
at android.app.Activity.performCreate(Activity.java:7035)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.io.IOException: create HardwareBuffer direct channel failed -12
at android.hardware.SystemSensorManager.createDirectChannelImpl(SystemSensorManager.java:613)
at android.hardware.SensorManager.createDirectChannel(SensorManager.java:927)
at de.makos.brakelightdatacollector.MesseinheitDirectChanel.registerListener(MesseinheitDirectChanel.java:63)
at de.makos.brakelightdatacollector.MainActivity.onCreate(MainActivity.java:64)
at android.app.Activity.performCreate(Activity.java:7044)
at android.app.Activity.performCreate(Activity.java:7035)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2731)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
As there are no examples or other documentation for the usage of Direct Channels I am not sure if I maybe missed something. I tried it on a real and a virtual device, both running Oreo 8.1 (API 27).
I looked a little bit into the native function but i could not find a reason.I also could not figure out what the -12 means.
I hope someone can clarify this.
Thanks in advance
bro, I think the reason that cause this issue is that your device doesn't support SensorDirectChannel.
I recently encountered a similar problem that I can't create a SensorDirectChannel by passing a MemoryFile instance with almost same Logcat information as what you got, but I CAN have it done by passing a HardwareBuffer instance, weird.
After checking some docs I found the reason from this site.
And the item 7.3.9 say:
Blockquote
If device implementations include direct sensor support, they:
[C-3-1] MUST correctly declare support of direct channel types and direct report rates level through the isDirectChannelTypeSupported and getHighestDirectReportRateLevel API.
[C-3-2] MUST support at least one of the two sensor direct channel types for all sensors that declare support for sensor direct channel
TYPE_HARDWARE_BUFFER
TYPE_MEMORY_FILE
SHOULD support event reporting through sensor direct channel for primary sensor (non-wakeup variant) of the following types:
TYPE_ACCELEROMETER
TYPE_ACCELEROMETER_UNCALIBRATED
TYPE_GYROSCOPE
TYPE_GYROSCOPE_UNCALIBRATED
TYPE_MAGNETIC_FIELD
TYPE_MAGNETIC_FIELD_UNCALIBRATED
So, obviously the sensor vendor must make their sensor support the TYPE_HARDWARE_BUFFER SensorDirectChannel or TYPE_MEMORY_FILE SensorDirectChannel or both of them, or you cannot make use of them.
At last, I check the acceleration sensor of my device (Pixel2) via isDirectChannelTypeSupported and got an expected result as follows:
resultscreenshot.
Hope it can help you.
Btw, my English is not so good. Apologize if it makes you confused.