I've already read serveral Q&A's from SO and did not found a solution.
My problem is: I run my app from AndroidStudio and get the error bellow, then I run gradlew clean installDebug and code works just fine (outside AS, with NO changes).
I did NOT forgot to include my activity into AndroidManifest.
10-13 13:36:18.261 1457-1457/my.package E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: my.package, PID: 1457
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{my.package/my.package.activity.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "my.package.activity.MainActivity" on path: DexPathList[[zip file "/data/app/my.package-1.apk"],nativeLibraryDirectories=[/data/app-lib/my.package-1, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
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:5001)
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:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "my.package.activity.MainActivity" on path: DexPathList[[zip file "/data/app/my.package-1.apk"],nativeLibraryDirectories=[/data/app-lib/my.package-1, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2101)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
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:5001)
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:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
I'm using Android Studio 0.8.12 and this is reproducible with real devices and emulator (Genymotion).
EDIT
I've tried both "full path" and "class name only" into my AndroidManifest file to declare activities. And it still doesn't explain (IMHO) why it works via command line with gradle.
Related
I have tried every answer for this on Google, but none worked for me.
I have just created an app I Android studio and add .jar file and simply running it.
But the app crashes leaving with below error message.
FATAL EXCEPTION: main Process: com.vtek.cam_pwr_flsh_cntrl, PID: 4850
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.vtek.cam_pwr_flsh_cntrl/com.vtek.cam_pwr_flsh_cntrl.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.vtek.cam_pwr_flsh_cntrl.MainActivity" on path: DexPathList[[zip file "/data/app/com.vtek.cam_pwr_flsh_cntrl-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.vtek.cam_pwr_flsh_cntrl-2, /vendor/lib, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121)
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.ClassNotFoundException: Didn't find class "com.vtek.cam_pwr_flsh_cntrl.MainActivity" on path: DexPathList[[zip file "/data/app/com.vtek.cam_pwr_flsh_cntrl-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.vtek.cam_pwr_flsh_cntrl-2, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2112)
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)
Check in your manifest file if you have declared the class as an activity.
If missing, do it.
Clean and REBUILD the code.
Hope this helps.
I'm trying to use Android Navigation Drawer with Page (Pager) Sliding tab Strip (https://github.com/Balaji-K13/Navigation-drawer-page-sliding-tab-strip), but i couldn't make it work. I'm using android studio. I made the imports in main project, and doesn't show any error, but when i run into a device (virtual or real) get this error:
05-22 10:38:20.200 1434-1434/com.webileapps.navdrawer E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.webileapps.navdrawer, PID: 1434
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.webileapps.navdrawer/com.webileapps.navdrawer.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.webileapps.navdrawer.MainActivity" on path: DexPathList[[zip file "/data/app/com.webileapps.navdrawer-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.webileapps.navdrawer-1, /system/lib]]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2102)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
at android.app.ActivityThread.access$700(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4998)
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:777)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.webileapps.navdrawer.MainActivity" on path: DexPathList[[zip file "/data/app/com.webileapps.navdrawer-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.webileapps.navdrawer-1, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2093)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2226)
at android.app.ActivityThread.access$700(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4998)
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:777)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
at dalvik.system.NativeStart.main(Native Method)
So, thoughts?
I was also trying to implement it and got the same error .After lot of effort I was able to run it but received the similar error as you have received .
I resolved the issue by
1:Close and start your eclipse .
2: copying the v4 jar of main project in all the library projects and deleting the existing ones .
The error comes due to mismatch of supportv4jar. Make all the supportv4jar of same version
3:after that Delete the gen and bin folder and clean the project and run .
I imported the Facebook SDK (v3.21.1) module into Android Studio (v1.0.2), and am trying to create a LoginActivity with com.facebook.widget.LoginButton as suggested in the documentation with the following code:
<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"
android:orientation="vertical">
<com.facebook.widget.LoginButton
android:id="#+id/authButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
/>
</LinearLayout>
However, the renderer in Android Studio says that it can't find the LoginButton class:
The following classes could not be found: - com.facebook.widget.LoginButton
I know for a fact that the class exists because I can open the file, and it is in the correct location:
I know it exists, but to prove to Android Studio that it does, I tried creating a class, as suggested in the renderer, and receive the following error:
I've tried the following as well:
Re-importing the Facebook SDK (deleting/re-importing the Facebook module: deleting the physical files, etc)
Re-opening my project
Re-opening Android Studio
Building the project
Nothing works. What's ridiculous is that even the auto-complete can see the class:
Edit: I tried just running the app in the emulator, ignoring the rendering error, and the app crashes with the following error:
12-31 03:47:15.593 2824-2824/com.test.playground E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.test.playground, PID: 2824
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.test.playground/com.test.playground.LoginActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class com.facebook.widget.LoginButton
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
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:5001)
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:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class com.facebook.widget.LoginButton
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:707)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
at android.app.Activity.setContentView(Activity.java:1929)
at com.test.playground.LoginActivity.onCreate(LoginActivity.java:15)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
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:5001)
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:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.widget.LoginButton" on path: DexPathList[[zip file "/data/app/com.test.playground-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.test.playground-2, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.view.LayoutInflater.createView(LayoutInflater.java:559)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
at android.app.Activity.setContentView(Activity.java:1929)
at com.test.playground.LoginActivity.onCreate(LoginActivity.java:15)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
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:5001)
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:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Again, the class does exist, it just seems that Android Studio can't find it. The class is viewable in the project directory under com.faceook.widget.LoginButton... I don't know what I'm missing. I've been trying to figure this out for hours and nothing is working.
For those who still have problem,
change com.facebook.widget.LoginButton to com.facebook.login.widget.LoginButton might help.
Have you integrated the Facebook SDK into your project? Check the build.gradle of your module and make sure that Facebook SDK is in dependencies. If not, add it and sync with Gradle and then try again.
The Facebook module should be added to the dependencies in build.gradle of the project that uses it:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':facebook')
}
As well, the Facebook module should be imported in settings.gradle:
include ':app', ':facebook'
So I am using the new Android Studio and I am trying to get JavaCV installed in the most basic setup. I made a brand new project with nothing in it, imported (I think unsuccessfully) the JavaCV library and then I am running one of the samples given in the JavaCV repo and I am getting the following error.
Process: com.example.calvintmoss.dejavid, PID: 1187
java.lang.UnsatisfiedLinkError: Couldn't load jniopencv_core from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.calvintmoss.dejavid-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.calvintmoss.dejavid-1, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:526)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535)
at org.bytedeco.javacpp.Loader.load(Loader.java:410)
at org.bytedeco.javacpp.Loader.load(Loader.java:353)
at org.bytedeco.javacpp.opencv_core.<clinit>(opencv_core.java:10)
at org.bytedeco.javacpp.helper.opencv_core$AbstractIplImage.create(opencv_core.java:909)
at com.example.calvintmoss.dejavid.MainActivity.initRecorder(MainActivity.java:249)
at com.example.calvintmoss.dejavid.MainActivity.onCreate(MainActivity.java:151)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
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:5001)
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:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsatisfiedLinkError: Couldn't load opencv_core from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.example.calvintmoss.dejavid-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.calvintmoss.dejavid-1, /system/lib]]]: findLibrary returned null
at java.lang.Runtime.loadLibrary(Runtime.java:358)
at java.lang.System.loadLibrary(System.java:526)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535)
at org.bytedeco.javacpp.Loader.load(Loader.java:401)
at org.bytedeco.javacpp.Loader.load(Loader.java:353)
at org.bytedeco.javacpp.opencv_core.<clinit>(opencv_core.java:10)
at org.bytedeco.javacpp.helper.opencv_core$AbstractIplImage.create(opencv_core.java:909)
at com.example.calvintmoss.dejavid.MainActivity.initRecorder(MainActivity.java:249)
at com.example.calvintmoss.dejavid.MainActivity.onCreate(MainActivity.java:151)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
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:5001)
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:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
I have read several of the other top posts on the issue but I cannot figure out what is wrong. I downloaded the JavaCV through gradle, then I added the lib and lib/areabi folders. I imported ffmpeg.jar, javacpp.jar, javacv.jar and opencv.jar all to the lib folder. and I extracted all the .SO files from opencv-android-arm.jar and ffmpeg-android-arm.jar and put them in the lib/armeabi just like the instructions on the git repo. I cannot figure out what is going on. Anyone have any ideas? Also my current setup is. Project->AppModule and then inside of that is where I have my lib and inside of lib i have the armeabi. Does anyone have any info on whats going on?
I had the same problem, I took the library from google.
Projects in use FFMpegRecoder and IplImage
My libs:
javacv-0.7-src.zip
javacv-0.7-bin.zip
javacv-0.7-cppjars.zip
https://code.google.com/p/javacv/
Try to add these five codes in dependency:
compile 'org.bytedeco:javacv:+'
compile 'org.bytedeco.javacpp-presets:opencv:3.0.0-1.1:android-x86'
compile 'org.bytedeco.javacpp-presets:ffmpeg:2.8.1-1.1:android-x86'
compile 'org.bytedeco.javacpp-presets:opencv:3.0.0-1.1:android-arm'
compile 'org.bytedeco.javacpp-presets:ffmpeg:2.8.1-1.1:android-arm'
Here you are using bytedeco instead of googlecode now
I really don't know what's going on with the Android app I'm building. At some point on its development, I started getting it breaking as soon as it starts in the emulator, with the message "Foo stopped". Here is the error log, if anyone could help me:
07-05 21:13:30.063 7647-7647/root.fazerumsom E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: root.fazerumsom, PID: 7647
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{root.fazerumsom/root.fazerumsom.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2110)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
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:5001)
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:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at android.content.ContextWrapper.getResources(ContextWrapper.java:89)
at android.view.ContextThemeWrapper.getResources(ContextThemeWrapper.java:78)
at root.fazerumsom.MainActivity.<init>(MainActivity.java:31)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1208)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2101)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
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:5001)
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:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
You're calling getResources() from a field initializer. Something like
private String mStr = getResources().getString(...);
(or with drawables or other kind of resources).
This is not valid, since the Context isn't set up yet. Move this assignment inside the onCreate() method.
The checked exception java.lang.NullPointerException is thrown when you're trying to use an object without reference,in simple words that means: you're trying to use a object variable without value.
Remember that a variable hold bits, primitive and non-primitive variable do, but the difference is that primitive variable hold the value in bits, but non-primitive variable hold the bits (like a direction) to access the object in memory, and when it's not being used anymore GGC (Garbage Colector) kills it.