Error:
02/01 14:12:04: Launching app
$ adb push /Users/Kamran/AndroidStudioProjects/App/app/build/outputs/apk/app-debug.apk /data/local/tmp/com.kami2017.app
$ adb shell pm install -r "/data/local/tmp/com.kami2017.app"
Success
$ adb shell am start -n "com.kami2017.app/com.kami2017.app.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 2284 on device emulator-5554
W/System: ClassLoader referenced unknown path: /data/app/com.kami2017.app-1/lib/x86
[ 02-01 14:12:28.511 1531: 1552 D/ ]
HostConnection::get() New Host Connection established 0x85a8d240, tid 1552
I/InstantRun: Instant Run Runtime started. Android package is com.kami2017.app, real application class is null.
W/System: ClassLoader referenced unknown path: /data/app/com.kami2017.app-1/lib/x86
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
D/AndroidRuntime: Shutting down VM
--------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.kami2017.app, PID: 2284
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.kami2017.app/com.kami2017.app.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.webkit.WebSettings android.webkit.WebView.getSettings()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.webkit.WebSettings android.webkit.WebView.getSettings()' on a null object reference
at com.kami2017.app.MainActivity.onCreate(MainActivity.java:17)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Application terminated.
I think you did not give any id for your WebView in xml file. You are trying to access that WebView.
FYI please look into following link:
Getting void android.webkit.WebView.loadUrl while loading webview in dialog in Android?
Your webview is null. Have you created an instance for the webview from your xml file in your activity?
WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
Or you should create a new webview programmatically:
WebView webView = new WebView(this);
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 days ago.
Improve this question
02/14 02:23:29: Launching 'app' on Nitin phone.
App restart successful without requiring a re-install.
$ adb shell am start -n "com.example.logsignsql/com.example.logsignsql.LoginActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 18128 on device 'Nitin_phone [emulator-5554]'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/zygote: Late-enabling -Xcheck:jni
W/zygote: Unexpected CPU variant for X86 using defaults: x86
D/AppCompatDelegate: Checking for metadata for AppLocalesMetadataHolderService : Service not found
E/ThemeUtils: View class androidx.appcompat.widget.AppCompatEditText is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
E/ThemeUtils: View class androidx.appcompat.widget.AppCompatEditText is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
E/ThemeUtils: View class androidx.appcompat.widget.AppCompatButton is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
E/ThemeUtils: View class androidx.appcompat.widget.AppCompatTextView is an AppCompat widget that can only be used with a Theme.AppCompat theme (or descendant).
W/ResourceType: Attempt to retrieve bag 0x7f100218 which is invalid or in a cycle.
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.logsignsql, PID: 18128
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.logsignsql/com.example.logsignsql.LoginActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:926)
at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:889)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:763)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:203)
at com.example.logsignsql.LoginActivity.onCreate(LoginActivity.java:21)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
I am following the tutorial here
I am just trying to get a feel for Android development and AWS integration. I setup the basic helloworld Android app following this guide. Then went on to add the AWS components in the first link.
When I get to the "Monitor Analytics" section, my project will build but throw an exception at runtime.
The exception is as follows:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xx.xxxx.wearables_data_receiver.app/com.xx.xxxx.wearables_data_receiver.feature.MainActivity}: java.lang.RuntimeException: Failed to read awsconfiguration.json please check that it is correctly formed.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
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)
Caused by: java.lang.RuntimeException: Failed to read awsconfiguration.json please check that it is correctly formed.
at com.amazonaws.mobile.config.AWSConfiguration.readInputJson(AWSConfiguration.java:99)
at com.amazonaws.mobile.config.AWSConfiguration.<init>(AWSConfiguration.java:83)
at com.amazonaws.mobile.config.AWSConfiguration.<init>(AWSConfiguration.java:68)
at com.amazonaws.mobile.config.AWSConfiguration.<init>(AWSConfiguration.java:45)
at com.amazonaws.mobile.client.AWSMobileClient.initialize(AWSMobileClient.java:155)
at com.xx.xxxx.wearables_data_receiver.feature.MainActivity.onCreate(MainActivity.java:51)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
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)
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:1351)
at android.content.res.Resources.openRawResource(Resources.java:1265)
at android.content.res.Resources.openRawResource(Resources.java:1241)
at com.amazonaws.mobile.config.AWSConfiguration.readInputJson(AWSConfiguration.java:88)
The line:
at com.xx.xxxx.wearables_data_receiver.feature.MainActivity.onCreate(MainActivity.java:51)
Points to the "AWSMobileClient.getInstance().initialize" call from the tutorial in the first link:
AWSMobileClient.getInstance().initialize(this, new AWSStartupHandler() {
#Override
public void onComplete(AWSStartupResult awsStartupResult) {
System.out.println("AWSMobileClient is instantiated and you are connected to AWS!");
}
}).execute();
I'm not sure what's going on here, I have tried opening up the file permissions, and placing it in a few different directories but to no avail. Any help would be greatly appreciated.
The error is due to missing awsconfiguration.json file.
Caused by: java.lang.RuntimeException: Failed to read awsconfiguration.json please check that it is correctly formed.
Could you make sure that you have the awsconfiguration.json file placed in the res/raw directory and has valid json? If you did the set up using Amplify CLI it should always automatically update the awsconfiguration.json file with required information.
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 am not sure if this is the right place to ask this question but I can't find help anywhere. I'm trying to get this application to work but I've run into some errors.
Clicking "Open gallery" button immediately crashes whole app with this error:
FATAL EXCEPTION: main
Process: com.niel.galleryphotoapp, PID: 3691
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.niel.galleryphotoapp/com.niel.galleryphotoapp.HomeFragmentActivity}: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=3691, uid=10086 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=3691, uid=10086 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
at android.os.Parcel.readException(Parcel.java:1684)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
at android.content.ContentResolver.query(ContentResolver.java:532)
at android.content.ContentResolver.query(ContentResolver.java:474)
at com.niel.galleryphotoapp.DeviceImageManager.getPhoneAlbums(DeviceImageManager.java:34)
at com.niel.galleryphotoapp.HomeFragmentActivity.onCreate(HomeFragmentActivity.java:80)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
I don't know why it is happening, I checked the manifest and it seems the required permissions are there.
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
I'm using Android Studio 2.3.3 + Nexus 4 API 25 emulator.
Although you have included permissions in your manifest, you also need to request runtime permissions as well. Everything you need to know is here:
https://developer.android.com/training/permissions/requesting.html
As cjnash said, you need to ask for runtime permissions as well. If you need a quick way just to try it, you can go in your device settings and manually give your app the permissions it needs to run.
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.