ToastFactory crash in HUAWEI Devices - java

I face crash in HUAWEI Devices with android version 6.0 & 6.0.1.
it looks the crash related to toast in HUAWEI Rom, this information I got from Crashlytics.
even the crash is not in my app package, the crash comes totally from com.huawei.android.hwcontrol.ToastFactory
anyone has any idea how to resolve or overcome this issue?
crash info:
Fatal Exception: android.view.InflateException: Binary XML file line #33: Binary XML file line #33: Error inflating class TextView
at android.view.LayoutInflater.inflate(LayoutInflater.java:558)
at android.view.LayoutInflater.inflate(LayoutInflater.java:434)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at com.huawei.android.hwcontrol.ToastFactory.layoutInflate(ToastFactory.java:55)
at android.widget.Toast.makeText(Toast.java:271)
at android.widget.Toast.makeText(Toast.java:298)
at android.widget.TextView.onTextContextMenuItem(TextView.java:9455)
at android.widget.Editor$TextActionModeCallback.onActionItemClicked(Editor.java:3303)
at com.android.internal.policy.PhoneWindow$DecorView$ActionModeCallback2Wrapper.onActionItemClicked(PhoneWindow.java:3656)
at com.android.internal.view.FloatingActionMode$3.onMenuItemSelected(FloatingActionMode.java:88)
at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:761)
at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:904)
at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:894)
at com.android.internal.view.FloatingActionMode$4.onMenuItemClick(FloatingActionMode.java:114)
at com.android.internal.widget.FloatingToolbar$FloatingToolbarMainPanel$1.onClick(FloatingToolbar.java:1045)
at android.view.View.performClick(View.java:5264)
at android.view.View$PerformClick.run(View.java:21297)
at android.os.Handler.handleCallback(Handler.java:743)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5621)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)

Related

Android studio not showing exception Class and line numbers

I've been using android studio for a while and whenever an exception occurs the information shown in the stacktrace does not contain the class in which the error occured or the line number. It is not even colored blue like it is supposed to. Here's an example of a stacktrace that is thrown:
ava.lang.StringIndexOutOfBoundsException: length=2; index=3
at java.lang.String.indexAndLength(String.java:579)
at java.lang.String.substring(String.java:1438)
at com.patriceandala.myapplication.utils.D.a(SourceFile:101)
at com.patriceandala.myapplication.utils.D.a(SourceFile:29)
at com.patriceandala.myapplication.utils.B.a(SourceFile:77)
at d.b.a.a.run(SourceFile:46)
at android.os.Handler.handleCallback(Handler.java:800)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5371)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
at dalvik.system.NativeStart.main(Native Method)
It only shows 'SourceFile' yet I don't have a class with that name. How can I fix this?
Disable ProGuard in debug mode and check.
Proguard is a free Java class file shrinker, optimizer, obfuscator and preverifier. It makes the code unreadable. So disable this in debug mode.

Sensortag20 Program Crashes connecting to bluetooth device

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.

Adding ".so" library to my android studio project

I am having issues when i try to add a spatialite database to my android studio projet.I followed this tutorial https://www.gaia-gis.it/fossil/libspatialite/wiki?name=spatialite-android-tutorial , as mentioned i added two folders to my project :
the native spatialite libraries: they are places in a folder named libs in my App directory and contains several folders for different platforms that hold the main library, called libspatialite.so
the basic API classes, contained in the jsqlite package
Despite this ,i am getting this error :
11-13 13:52:17.358 1853-1853/liara.geodatamining W/System.err﹕ Unable to load sqlite_jni: java.lang.UnsatisfiedLinkError: Couldn't load proj from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/liara.geodatamining-2.apk"],nativeLibraryDirectories=[/data/app-lib/liara.geodatamining-2, /system/lib]]]: findLibrary returned null
11-13 13:52:17.358 1853-1853/liara.geodatamining W/dalvikvm﹕ No implementation found for native Ljsqlite/Database;.internal_init:()V
11-13 13:52:17.358 1853-1853/liara.geodatamining W/dalvikvm﹕ Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Ljsqlite/Database;
11-13 13:52:17.358 1853-1853/liara.geodatamining W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb2d19b20)
11-13 13:52:17.358 1853-1853/liara.geodatamining E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: liara.geodatamining, PID: 1853
java.lang.UnsatisfiedLinkError: Native method not found: jsqlite.Database.internal_init:()V
at jsqlite.Database.internal_init(Native Method)
at jsqlite.Database.<clinit>(Database.java:951)
at liara.geodatamining.map.onCreate(map.java:116)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
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:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Am i missing something ?
This sounds a lot like you haven't included the appropriate version of the NDK for your emulator. Per the Android docs, the following platforms support Android NDK
ARM
ARM-NEON
x86
MIPS
The most common by far for real devices is ARM (armeabi-v7a). In fact, it's probably almost no loss to not include anything except for this for a published build. But the emulators often work off of x86. I know I have a NDK file for x86 that I remove every time I'm ready to build for release, and re-add when I want to use my desktop emulator.
if you're only using .so files and not compiling any C/C++ sources yourself, you don't need the NDK.
With Android Studio, the place where you drop .so files isn't the same than with eclipse. Now it's inside jniLibs/<ABI> where ABI can be armeabi, armeabi-v7a, x86, x86_64, mips, mips64, arm64-v8a.
You can check that your .so files are properly integrated by opening your APK as a zip file and simply checking that your .so files are inside lib/<abi> folders.

google-play-services won't build into Android Maps HelloWorld project in Eclipse

UPDATE: A UI bug was preventing me from importing google-play-services_lib. I had to click immediately below the SDK list to be able to scroll to see the Library box. See the image in the accepted answer for more info.
I am using Android IDE to get a Hello World map app, which I have named Intactless2. The files are all named correctly, android-support-v4.jar in /libs, I have a valid API key, etc.
I followed Google's Android Maps guide, copying and pasting the Java and activity_main.xml verbatim:
https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2
I correctly added everything there to my manifest. I got an error on <meta-data android:name="com.google.android.gms.version"... 's value being incorrect, so I hardcoded the integer from the version.xml file so that it's android:value="4030500". Otherwise my manifest is unchanged.
I tried all of the solutions in the top Google hits for the error messages I'm getting and it still won't run. Normally, this would indicate an idiosyncratic bug that I haven't thought about that might even be unrelated to Google Play Services, but I rebuilt it exactly as Google's guide suggests and redid all of the recommendations in those posts and still can't use Google Play Services.
I am running a 4.4 emulator and 4.4 is the minimum version my project will build to. I have tried the following to be able to use google-play-services/google-play-services_lib in my app:
1) Made an Eclipse project for Google Play Services and added it to my project. Right-click on my project -> Properties -> Java Build Path -> Projects Add -> google-play-services_lib.
a) Checked google-play-services_lib in Order & Export
b) Unchecked oogle-play-services_lib in Order and Export
2) Copy-pasted google-play-services, google-play-services_lib, and google-play-services.properties from my Android SDK directory to my /libs directory in my project.
1) Properties -> Android -> Target Build Path -> Android 4.4
2) Properties -> Android -> Target Build Path -> Google APIs (the one directly below "Android 4.4)
That's a lot of combinations including the solutions people on StackOverflow have suggested.
Also, if I add <uses-library android:name="com.google.android.gms.maps" /> (or remove the gms as some guides advise) to my manifest, I get this LogCat error:
11-13 00:57:18.890: E/PackageManager(938): Package com.example.intactless2 requires unavailable shared library com.google.android.gms.maps; failing!
Importing google-play-services/google-play-services_lib as an Eclipse project:
Screenshot of google-play-services_lib Eclipse project: http://postimg.org/image/ukbqjk9lp/
Screenshot of my hello world Maps project in Package Explorer: http://postimg.org/image/589t2137h/
Console output:
...
[2013-11-12 21:57:13 - Intactless2] Installing Intactless2.apk...
[2013-11-12 21:57:19 - Intactless2] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2013-11-12 21:57:19 - Intactless2] Please check logcat output for more details.
[2013-11-12 21:57:19 - Intactless2] Launch canceled!
LogCat:
11-13 01:03:44.870: E/AndroidRuntime(1886): FATAL EXCEPTION: main
11-13 01:03:44.870: E/AndroidRuntime(1886): Process: com.example.intactless2, PID: 1886
11-13 01:03:44.870: E/AndroidRuntime(1886): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.intactless2/com.example.intactless2.MainActivity}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
11-13 01:03:44.870: E/AndroidRuntime(1886): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2176)
11-13 01:03:44.870: E/AndroidRuntime(1886): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
11-13 01:03:44.870: E/AndroidRuntime(1886): at android.app.ActivityThread.access$700(ActivityThread.java:135)
...
Putting google-play-services.jar, google-play-services_lib.jar, and google-play-services.jar.properties directly into my project's /libs directory
Screenshot of my hello world Maps project in Package Explorer: http://postimg.org/image/l68z4crl7/
Console output:
...
[2013-11-12 22:15:20 - Intactless2] Uploading Intactless2.apk onto device 'emulator-5554'
[2013-11-12 22:15:20 - Intactless2] Installing Intactless2.apk...
[2013-11-12 22:15:37 - Intactless2] Success!
[2013-11-12 22:15:37 - Intactless2] Starting activity com.example.intactless2.MainActivity on device emulator-5554
[2013-11-12 22:15:41 - Intactless2] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.intactless2/.MainActivity }
LogCat:
11-13 01:15:43.990: E/AndroidRuntime(1959): FATAL EXCEPTION: main
11-13 01:15:43.990: E/AndroidRuntime(1959): Process: com.example.intactless2, PID: 1959
11-13 01:15:43.990: E/AndroidRuntime(1959): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
11-13 01:15:43.990: E/AndroidRuntime(1959): at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
11-13 01:15:43.990: E/AndroidRuntime(1959): at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
11-13 01:15:43.990: E/AndroidRuntime(1959): at android.app.Activity.onCreateView(Activity.java:4784)
11-13 01:15:43.990: E/AndroidRuntime(1959): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
11-13 01:15:43.990: E/AndroidRuntime(1959): at android.view.LayoutInflater.inflate(LayoutInflater.java:469)
11-13 01:15:43.990: E/AndroidRuntime(1959): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
11-13 01:15:43.990: E/AndroidRuntime(1959): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
11-13 01:15:43.990: E/AndroidRuntime(1959): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
11-13 01:15:43.990: E/AndroidRuntime(1959): at android.app.Activity.setContentView(Activity.java:1928)
11-13 01:15:43.990: E/AndroidRuntime(1959): at com.example.intactless2.MainActivity.onCreate(MainActivity.java:11)
11-13 01:15:43.990: E/AndroidRuntime(1959): at android.app.Activity.performCreate(Activity.java:5243)
Thank you in advance! Any help is appreciated. :)
You mentioned you are using a 4.4 emulator - you need to use the Google APIs (Google Inc.) - API Level 19 emulator to test with Google Play Services.
I Think You have error in you XML file ,because in log-cat you are getting
Binary XML file line #2: Error inflating class fragment first you try to rectify it

MapActivity ClassDefNotFoundException at runtime

My Activity extends from MapActivity, I have descried it correctly in the manifest, I have put the <uses-library> tag inside the <application> tag I am building with goole apis library and the maps.jar is there only one time(no duplicates) and the app runs and works perfect on most devices.
However I got a crash report with ClassDefNotFoundException which occurred on ZTE Blade device with Android 2.1. I am building with google apis 2.1
Does anyone have suggestions for that?
I am providing the stack trace too:
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:2165)
at android.view.View.performClick(View.java:2506)
at android.view.View$PerformClick.run(View.java:9112)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3835)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at android.view.View$1.onClick(View.java:2160)
... 11 more
Caused by: java.lang.NoClassDefFoundError: com.testing.asd.android.ui.InfoActivity
at com.testing.asd.android.ui.HomeScreen.onClick(HomeScreen.java:60)
... 14 more
com.testing.asd.android.ui.InfoActivity extends MapActivity. The problem is only on one device so far. I tested it on Android 2.3 and 4.2 and it is ok there.
I'm not sure if this is the case with the ZTE Blade, but there are some devices (such as the Kindle Fire) that don't have the Google APIs. I think these phones will show a NoClassDefFoundError if your app uses MapView.

Categories

Resources