When I am using AlertDialog in ECLIPSE importing the followings
import android.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
My application builds but it's not the view I want. I want to use
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
But after installing the apk the application crashes. What I am doing wrong?
Crash log (perdon my long crash log)
07-19 13:09:13.273: I/Process(17722): Sending signal. PID: 17722 SIG: 9
07-19 13:09:20.993: D/ResourcesManager(17894): For user 0 new
overlays fetched Null
07-19 13:09:21.023: D/JniHelper(17894): JniHelper::setJavaVM
(0xb815f940), pthread_self() = -1225135284
07-19 13:09:21.063: D/Cocos2dxActivity(17894): model=SM-J510FN
07-19 13:09:21.063: D/Cocos2dxActivity(17894): product=j5xnltexx
07-19 13:09:21.063: D/Cocos2dxActivity(17894): isEmulator=false
07-19 13:09:21.073: E/SensorManager(17894): nativeGetSensorAtIndex:
name, vendor - 0, K2HH Acceleration , STM
07-19 13:09:21.083: E/SensorManager(17894): nativeGetSensorAtIndex:
name, vendor - 1, CM36672P Proximity Sensor, Capella Microsystems, Inc.
07-19 13:09:21.083: E/SensorManager(17894): nativeGetSensorAtIndex:
name, vendor - 2, SX9310 Grip Sensor, SEMTECH
07-19 13:09:21.083: E/SensorManager(17894): nativeGetSensorAtIndex:
name, vendor - 3, Screen Orientation Sensor, Samsung Electronics
07-19 13:09:21.093: V/PTServicesBridge(17894): PTServicesBridge -- INIT
07-19 13:09:21.113: W/PopupManager(17894): You have not specified a View
to use as content view for popups. Falling back to the Activity
content view. Note that this may not work as expected in multi-
screen environments
07-19 13:09:21.123: D/AndroidRuntime(17894): Shutting down VM
07-19 13:09:21.133: E/AndroidRuntime(17894): FATAL EXCEPTION: main
07-19 13:09:21.133: E/AndroidRuntime(17894): Process: com.tembo.huerun,
PID: 17894
07-19 13:09:21.133: E/AndroidRuntime(17894): java.lang.NoClassDefFoundError:
Failed resolution of: Landroid/support/v7/appcompat/R$attr;
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.support.v7.app.AlertDialog.resolveDialogTheme(AlertDialog.java:108)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.support.v7.app.AlertDialog$Builder.<init>(AlertDialog.java:285)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
com.tembo.huerun.AppRater.showRateDialog(AppRater.java:63)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
com.tembo.huerun.AppRater.app_launched(AppRater.java:52)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
com.tembo.huerun.PTPlayer.onCreate(PTPlayer.java:52)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.Activity.performCreate(Activity.java:6877)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3209)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3352)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.ActivityThread.access$1100(ActivityThread.java:223)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1797)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.os.Handler.dispatchMessage(Handler.java:102)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.os.Looper.loop(Looper.java:158)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
android.app.ActivityThread.main(ActivityThread.java:7231)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.reflect.Method.invoke(Native Method)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:1230)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
07-19 13:09:21.133: E/AndroidRuntime(17894): Caused by:
java.lang.ClassNotFoundException: Didn't find class
"android.support.v7.appcompat.R$attr" on path: DexPathList[[zip file
"/data/app/com.tembo.huerun-1/base.apk"],nativeLibraryDirectories=
[/data/app/com.tembo.huerun-1/lib/arm, /data/app/com.tembo.huerun-
1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
07-19 13:09:21.133: E/AndroidRuntime(17894): at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.ClassLoader.loadClass(ClassLoader.java:511)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.ClassLoader.loadClass(ClassLoader.java:469)
07-19 13:09:21.133: E/AndroidRuntime(17894): ... 17 more
07-19 13:09:21.133: E/AndroidRuntime(17894): Suppressed:
java.lang.ClassNotFoundException: android.support.v7.appcompat.R$attr
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.Class.classForName(Native Method)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.BootClassLoader.findClass(ClassLoader.java:781)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
07-19 13:09:21.133: E/AndroidRuntime(17894): at
java.lang.ClassLoader.loadClass(ClassLoader.java:504)
07-19 13:09:21.133: E/AndroidRuntime(17894): ... 18 more
07-19 13:09:21.133: E/AndroidRuntime(17894): Caused by:
java.lang.NoClassDefFoundError: Class not found using the boot class loader;
no stack trace available
07-19 13:09:22.903: I/Process(17894): Sending signal. PID: 17894 SIG: 9
add the apcompact-v7 jar file in your lib folder.
Related
01-25 06:27:51.270 8469-8469/? E/memtrack: Couldn't load memtrack module (No such file or directory)
01-25 06:27:51.270 8469-8469/? E/android.os.Debug: failed to load memtrack module: -2
01-25 06:27:51.810 8483-8483/? E/memtrack: Couldn't load memtrack module (No such file or directory)
01-25 06:27:51.810 8483-8483/? E/android.os.Debug: failed to load memtrack module: -2
01-25 06:27:51.980 8493-8499/? E/jdwp: Failed writing handshake bytes: Broken pipe (-1 of 14)
01-25 06:27:52.150 8493-8493/? E/dalvikvm: Could not find class 'com.google.android.chimera.Activity', referenced from method lq.b
01-25 06:27:52.290 8493-8493/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.a42914.map, PID: 8493
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.a42914.map/com.example.a42914.map.MapsActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
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)
Caused by: java.lang.NullPointerException
at com.example.a42914.map.MapsActivity.onStart(MapsActivity.java:240)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1171)
at android.app.Activity.performStart(Activity.java:5241)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2168)
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)
01-25 06:28:01.860 1574-1588/system_process E/WindowManager: Starting window AppWindowToken{9d7b2b80 token=Token{9d485c28 ActivityRecord{9d336b80 u0 com.example.a42914.map/.MapsActivity t42}}} timed out
You have a NullPointerException at ligne 240 in MapsActivity.java
I am using Android studio to build my app
I have 2 emulators the first uses Android 6.0 and the second uses Android 4.4
My app runs perfectly on the Android 6.0 but when I try it on 4.4 it crashes immediately.
I tried debugging the app by putting break point on the first like but it does not reach the first line. it crashes stright away.
The error message I got is not that clear, I dont know what the problem is and how to fix it.
01/23 17:26:16: Launching app
No apk changes detected since last installation, skipping installation of D:\__Schlogger\Android\Schlogger\app\build\outputs\apk\app-debug.apk
$ adb shell am force-stop com.asmgx.schlogger.app
$ adb shell am start -n "com.asmgx.schlogger.app/com.asmgx.schlogger.app.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.asmgx.schlogger.app | com.asmgx.schlogger.app.test
Waiting for application to come online: com.asmgx.schlogger.app | com.asmgx.schlogger.app.test
Waiting for application to come online: com.asmgx.schlogger.app | com.asmgx.schlogger.app.test
Waiting for application to come online: com.asmgx.schlogger.app | com.asmgx.schlogger.app.test
Connecting to com.asmgx.schlogger.app
I/dalvikvm: Debugger is active
I/System.out: Debugger has connected
I/System.out: waiting for debugger to settle...
Connected to the target VM, address: 'localhost:8607', transport: 'socket'
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1368)
W/dalvikvm: VFY: unable to resolve static field 7536 (common_google_play_services_unknown_issue) in Lcom/google/android/gms/R$string;
D/dalvikvm: VFY: replacing opcode 0x60 at 0x000e
D/AndroidRuntime: Shutting down VM
W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x9cd52b20)
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.asmgx.schlogger.app, PID: 2822
java.lang.NoClassDefFoundError: com.google.android.gms.R$string
at com.google.android.gms.common.internal.zzai.<init>(Unknown Source)
at com.google.firebase.FirebaseOptions.fromResource(Unknown Source)
at com.google.firebase.FirebaseApp.zzek(Unknown Source)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1591)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1562)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
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)
Disconnected from the target VM, address: 'localhost:8607', transport: 'socket'
-----------------------------------------------------------------------------------------------------
After applying the solutions provided, I got another error, and still does not know what does it mean?
01-23 03:02:29.954 9105-9105/? I/dalvikvm: Could not find method android.content.res.TypedArray.getType, referenced from method android.support.v7.widget.TintTypedArray.getType
01-23 03:02:29.954 9105-9105/? W/dalvikvm: VFY: unable to resolve virtual method 723: Landroid/content/res/TypedArray;.getType (I)I
01-23 03:02:29.954 9105-9105/? D/dalvikvm: VFY: replacing opcode 0x6e at 0x0008
01-23 03:02:29.964 9105-9105/? E/VdcInflateDelegate: Exception while inflating <vector>
org.xmlpull.v1.XmlPullParserException: Binary XML file line #17<vector> tag requires viewportHeight > 0
at android.support.graphics.drawable.VectorDrawableCompat.updateStateFromTypedArray(VectorDrawableCompat.java:720)
at android.support.graphics.drawable.VectorDrawableCompat.inflate(VectorDrawableCompat.java:654)
at android.support.graphics.drawable.VectorDrawableCompat.createFromXmlInner(VectorDrawableCompat.java:617)
at android.support.v7.widget.AppCompatDrawableManager$VdcInflateDelegate.createFromXmlInner(AppCompatDrawableManager.java:745)
at android.support.v7.widget.AppCompatDrawableManager.loadDrawableFromDelegates(AppCompatDrawableManager.java:365)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:195)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:127)
at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:147)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:27)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:53)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:205)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:525)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:74)
at com.asmgx.schlogger.app.MainActivity.onCreate(MainActivity.java:78)
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)
01-23 03:02:29.964 9105-9105/? D/AndroidRuntime: Shutting down VM
01-23 03:02:29.964 9105-9105/? W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x9cd52b20)
01-23 03:02:29.974 9105-9105/? D/dalvikvm: GC_FOR_ALLOC freed 365K, 12% free 3858K/4380K, paused 3ms, total 3ms
01-23 03:02:29.974 9105-9105/? E/UncaughtException: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.asmgx.schlogger.app/com.asmgx.schlogger.app.MainActivity}: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020054
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
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)
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020054
at android.content.res.Resources.loadDrawable(Resources.java:2101)
at android.content.res.Resources.getDrawable(Resources.java:700)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:127)
at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:147)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:27)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:53)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:205)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:525)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:74)
at com.asmgx.schlogger.app.MainActivity.onCreate(MainActivity.java:78)
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)
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:933)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:877)
at android.content.res.Resources.loadDrawable(Resources.java:2097)
at android.content.res.Resources.getDrawable(Resources.java:700)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:127)
at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:147)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:27)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:53)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:205)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:525)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:74)
at com.asmgx.schlogger.app.MainActivity.onCreate(MainActivity.java:78)
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)
01-23 03:02:29.974 9105-9130/? I/DynamiteModule: Considering local module com.google.android.gms.tagmanager:3 and remote module com.google.android.gms.tagmanager:8
01-23 03:02:29.974 9105-9130/? I/DynamiteModule: Selected remote version of com.google.android.gms.tagmanager, version >= 8
01-23 03:02:30.074 9105-9130/? W/GoogleTagManager: No container asset found in /assets/containers. Checking top level /assets directory for container assets.
01-23 03:02:30.194 9105-9130/? W/GoogleTagManager: Tag Manager's event handler WILL NOT be installed (no container loaded)
01-23 03:02:30.194 9105-9130/? I/GoogleTagManager: Tag Manager initilization took 218ms
01-23 03:02:30.194 9105-9130/? D/FA: Logging event (FE): _ae, Bundle[{_o=crash, timestamp=1485158549979, fatal=1}]
01-23 03:02:30.194 9105-9130/com.asmgx.schlogger.app V/FA: Using measurement service
01-23 03:02:30.204 9105-9130/com.asmgx.schlogger.app V/FA: Connection attempt already in progress
01-23 03:02:30.234 9105-9131/com.asmgx.schlogger.app D/dalvikvm: GC_FOR_ALLOC freed 454K, 14% free 3914K/4528K, paused 7ms, total 10ms
01-23 03:02:30.294 9105-9105/com.asmgx.schlogger.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.asmgx.schlogger.app, PID: 9105
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.asmgx.schlogger.app/com.asmgx.schlogger.app.MainActivity}: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020054
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
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)
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/abc_vector_test.xml from drawable resource ID #0x7f020054
at android.content.res.Resources.loadDrawable(Resources.java:2101)
at android.content.res.Resources.getDrawable(Resources.java:700)
at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:374)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:200)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:188)
at android.support.v7.widget.AppCompatDrawableManager.checkVectorDrawableSetup(AppCompatDrawableManager.java:723)
at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:193)
at android.support.v7.widget.TintTypedArray.getDrawableIfKnown(TintTypedArray.java:81)
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:127)
at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:147)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:27)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:53)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:205)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:185)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:525)
at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:74)
at com.asmgx.schlogger.app.MainActivity.onCreate(MainActivity.java:78)
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)
Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vector
Try to use this
STEP 1:
Go to your dependency and add this line
compile 'com.android.support:multidex:1.0.1'
and in the defaultConfig Section add this
defaultConfig {
minSdkVersion xx
targetSdkVersion xx
versionCode x
multiDexEnabled true
}
Then
Create a class called e.g MyApp.java
public class MyApp extends Application{
#Override
public void onCreate() {
super.onCreate();
}
#Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
STEP :2
Go to your manifest and do the following in the Application Tag
<application
android:name="MyApp"
.
.
.
in your gradle, set
multiDexEnabled true
and in Application class:
Extend Application class with MultiDexApplication
#Override
protected void attachBaseContext(Context base) {
MultiDex.install(this);
super.attachBaseContext(base);
}
because MultiDexApplication has not been extended so that it can't include gms and any other dex classes so it's giving error at starting of gms String.
You can refer here for more information on how to use multidex :
https://developer.android.com/studio/build/multidex.html
We have problem related with Imsdroid Integration with my android application.During the application startup it gives error as follow..
ExceptionInInitializerError
My log file is:
07-19 19:55:58.047: E/AndroidRuntime(6858): FATAL EXCEPTION: main
07-19 19:55:58.047: E/AndroidRuntime(6858): java.lang.ExceptionInInitializerError
07-19 19:55:58.047: E/AndroidRuntime(6858): at org.doubango.imsdroid.MyMainClass.<init>(MyMainClass.java:43)
07-19 19:55:58.047: E/AndroidRuntime(6858): at java.lang.Class.newInstanceImpl(Native Method)
07-19 19:55:58.047: E/AndroidRuntime(6858): at java.lang.Class.newInstance(Class.java:1319)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2099)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.app.ActivityThread.access$600(ActivityThread.java:149)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.os.Handler.dispatchMessage(Handler.java:99)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.os.Looper.loop(Looper.java:153)
07-19 19:55:58.047: E/AndroidRuntime(6858): at android.app.ActivityThread.main(ActivityThread.java:4987)
07-19 19:55:58.047: E/AndroidRuntime(6858): at java.lang.reflect.Method.invokeNative(Native Method)
07-19 19:55:58.047: E/AndroidRuntime(6858): at java.lang.reflect.Method.invoke(Method.java:511)
07-19 19:55:58.047: E/AndroidRuntime(6858): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
07-19 19:55:58.047: E/AndroidRuntime(6858): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
07-19 19:55:58.047: E/AndroidRuntime(6858): at dalvik.system.NativeStart.main(Native Method)
07-19 19:55:58.047: E/AndroidRuntime(6858): Caused by: java.lang.NullPointerException
07-19 19:55:58.047: E/AndroidRuntime(6858): at org.doubango.ngn.NgnEngine.<clinit>(NgnEngine.java:75)
07-19 19:55:58.047: E/AndroidRuntime(6858): ... 16 more
I think its with your AndroidManifest. Try putting this on your Application tag
android:name="org.doubango.ngn.NgnApplication"
or
if you have a custom Application object extend NgnApplication object instead of Application object.
If you want to use imsdroid in your application then you need to use ChromeView instead of WebView in android xml file.
I found more information and at here
<us.costan.chrome.ChromeView
android:id="#+id/customWebView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
I am trying to connect postgreSQL, using JBDC, to my Android app.
I have written a small program which will try to connect to the database and then the textView will change to connected.
I know for sure that the url is not correct but I followed this website: http://jdbc.postgresql.org/documentation/80/connect.html and used the first one.
Here is my code:
import android.app.Activity;
import android.content.Context;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import java.sql.*;
import java.util.Properties;
public class MainActivity extends Activity {
private static final String dbname = "postgres";
public static final String USER = " yOUR_DATABASE_USERNAME";
public static final String PASSWORD = "DATABASE_PASSWORD";
TextView text;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
text = (TextView) findViewById(R.id.tvConnect);
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String url = "jdbc:postgresql:localhost:5432/postgres";
Connection conn;
try {
//conn = DriverManager.getConnection(url, USER, PASSWORD);
conn = DriverManager.getConnection(url);
text.setText("Connected");
} catch (SQLException e) {
// TODO Auto-generated catch block
Log.e("Tag", "Description", e);
}
}
}
These are the errors I am getting:
07-19 19:23:46.023: E/Tag(1246): Description
07-19 19:23:46.023: E/Tag(1246): org.postgresql.util.PSQLException: Something unusual has occurred to cause the driver to fail. Please report this exception.
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.Driver.connect(Driver.java:300)
07-19 19:23:46.023: E/Tag(1246): at java.sql.DriverManager.getConnection(DriverManager.java:179)
07-19 19:23:46.023: E/Tag(1246): at java.sql.DriverManager.getConnection(DriverManager.java:144)
07-19 19:23:46.023: E/Tag(1246): at com.sql.postgre.MainActivity.onCreate(MainActivity.java:46)
07-19 19:23:46.023: E/Tag(1246): at android.app.Activity.performCreate(Activity.java:5231)
07-19 19:23:46.023: E/Tag(1246): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
07-19 19:23:46.023: E/Tag(1246): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
07-19 19:23:46.023: E/Tag(1246): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
07-19 19:23:46.023: E/Tag(1246): at android.app.ActivityThread.access$800(ActivityThread.java:135)
07-19 19:23:46.023: E/Tag(1246): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
07-19 19:23:46.023: E/Tag(1246): at android.os.Handler.dispatchMessage(Handler.java:102)
07-19 19:23:46.023: E/Tag(1246): at android.os.Looper.loop(Looper.java:136)
07-19 19:23:46.023: E/Tag(1246): at android.app.ActivityThread.main(ActivityThread.java:5017)
07-19 19:23:46.023: E/Tag(1246): at java.lang.reflect.Method.invokeNative(Native Method)
07-19 19:23:46.023: E/Tag(1246): at java.lang.reflect.Method.invoke(Method.java:515)
07-19 19:23:46.023: E/Tag(1246): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
07-19 19:23:46.023: E/Tag(1246): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
07-19 19:23:46.023: E/Tag(1246): at dalvik.system.NativeStart.main(Native Method)
07-19 19:23:46.023: E/Tag(1246): Caused by: android.os.NetworkOnMainThreadException
07-19 19:23:46.023: E/Tag(1246): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1145)
07-19 19:23:46.023: E/Tag(1246): at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
07-19 19:23:46.023: E/Tag(1246): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
07-19 19:23:46.023: E/Tag(1246): at java.net.InetAddress.getByName(InetAddress.java:289)
07-19 19:23:46.023: E/Tag(1246): at java.net.InetSocketAddress.<init>(InetSocketAddress.java:105)
07-19 19:23:46.023: E/Tag(1246): at java.net.InetSocketAddress.<init>(InetSocketAddress.java:90)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.core.PGStream.<init>(PGStream.java:60)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:101)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:136)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.Driver.makeConnection(Driver.java:410)
07-19 19:23:46.023: E/Tag(1246): at org.postgresql.Driver.connect(Driver.java:280)
This might be a late answer but after reading about jdbc drivers for android many people have said that the jdbc jar does not work well at all for android and only one or two versions of the jar actually worked. Otherwise the best way of connecting your database with android is via a web service and using either Volley or Retrofit to talk to the database.
Android has built-in support for SQLite database. Please refer to android documentation or you may download this code demo to quickly check how to code it.
Still if it is required to access any other database server, that server must be running on a machine as android does not host any SQL server so localhost should not work, if you are testing your code with emulator use 10.0.2.2 instead of localhost to access your postgres server on host development machine.
Another important issue to take care of while accessing a database server involves network, executing network related code is not allowed to be executed as part of an activity class hence you must write your code in AsyncTask android API.
In the method below, NasaDailyFragment is always null in the debugger. The method call NasaDailyFragment.onRefresh(); fails using because of this. I can't figure out why its null.
public class NasaAppActivity extends FragmentActivity {
//other methods
public void onRefreshClicked(View view){
Log.d("debug", "in run");
FragmentManager fragmentManager=getSupportFragmentManager();
NasaDailyImage NasaDailyFragment=(NasaDailyImage)fragmentManager.findFragmentById(R.id.fragment_iotd);
if(NasaDailyFragment!=null){
Log.d("debug", "fragment has been casted and is NOT null!!!");
}
NasaDailyFragment.onRefresh();//always crashes here because NasaDailyFragment is null, this is "line 40" of the code
}
}
Here's the xml for the fragment defined by R.id.fragment_iotd
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment android:name="com.wajumbie.nasadailyimage.NasaDailyImage"
android:id="#+id/fragment_iotd"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
The logcat output
07-19 11:21:25.916: D/debug(534): in run
07-19 11:21:25.916: D/AndroidRuntime(534): Shutting down VM
07-19 11:21:25.916: W/dalvikvm(534): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
07-19 11:21:25.936: E/AndroidRuntime(534): FATAL EXCEPTION: main
07-19 11:21:25.936: E/AndroidRuntime(534): java.lang.IllegalStateException: Could not execute method of the activity
07-19 11:21:25.936: E/AndroidRuntime(534): at android.view.View$1.onClick(View.java:3044)
07-19 11:21:25.936: E/AndroidRuntime(534): at android.view.View.performClick(View.java:3511)
07-19 11:21:25.936: E/AndroidRuntime(534): at android.view.View$PerformClick.run(View.java:14105)
07-19 11:21:25.936: E/AndroidRuntime(534): at android.os.Handler.handleCallback(Handler.java:605)
07-19 11:21:25.936: E/AndroidRuntime(534): at android.os.Handler.dispatchMessage(Handler.java:92)
07-19 11:21:25.936: E/AndroidRuntime(534): at android.os.Looper.loop(Looper.java:137)
07-19 11:21:25.936: E/AndroidRuntime(534): at android.app.ActivityThread.main(ActivityThread.java:4424)
07-19 11:21:25.936: E/AndroidRuntime(534): at java.lang.reflect.Method.invokeNative(Native Method)
07-19 11:21:25.936: E/AndroidRuntime(534): at java.lang.reflect.Method.invoke(Method.java:511)
07-19 11:21:25.936: E/AndroidRuntime(534): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-19 11:21:25.936: E/AndroidRuntime(534): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-19 11:21:25.936: E/AndroidRuntime(534): at dalvik.system.NativeStart.main(Native Method)
07-19 11:21:25.936: E/AndroidRuntime(534): Caused by: java.lang.reflect.InvocationTargetException
07-19 11:21:25.936: E/AndroidRuntime(534): at java.lang.reflect.Method.invokeNative(Native Method)
07-19 11:21:25.936: E/AndroidRuntime(534): at java.lang.reflect.Method.invoke(Method.java:511)
07-19 11:21:25.936: E/AndroidRuntime(534): at android.view.View$1.onClick(View.java:3039)
07-19 11:21:25.936: E/AndroidRuntime(534): ... 11 more
07-19 11:21:25.936: E/AndroidRuntime(534): Caused by: java.lang.NullPointerException
07-19 11:21:25.936: E/AndroidRuntime(534): at com.wajumbie.nasadailyimage.NasaAppActivity.onRefreshClicked(NasaAppActivity.java:40)
07-19 11:21:25.936: E/AndroidRuntime(534): ... 14 more
07-19 11:21:26.556: I/dalvikvm(534): threadid=3: reacting to signal 3
07-19 11:21:26.586: I/dalvikvm(534): Wrote stack traces to '/data/anr/traces.txt'