I'm trying to integrate Facebook SDK in my android app. I downloaded facebook-android-sdk-4.5.1 and followed the steps in the developer guide. As I'm trying to run the sample HelloFacebookSample placed in the samples folder of the SDK, I'm getting the following error:
08-31 18:37:19.399: E/AndroidRuntime(277): FATAL EXCEPTION: main
08-31 18:37:19.399: E/AndroidRuntime(277): java.lang.NoSuchFieldError: java.util.Locale.ROOT
08-31 18:37:19.399: E/AndroidRuntime(277): at com.facebook.FacebookSdk.loadDefaultsFromMetadata(FacebookSdk.java:623)
08-31 18:37:19.399: E/AndroidRuntime(277): at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:203)
08-31 18:37:19.399: E/AndroidRuntime(277): at com.facebook.FacebookSdk.sdkInitialize(FacebookSdk.java:173)
08-31 18:37:19.399: E/AndroidRuntime(277): at com.example.image.HelloFacebookSampleActivity.onCreate(HelloFacebookSampleActivity.java:117)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.os.Handler.dispatchMessage(Handler.java:99)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.os.Looper.loop(Looper.java:123)
08-31 18:37:19.399: E/AndroidRuntime(277): at android.app.ActivityThread.main(ActivityThread.java:4627)
08-31 18:37:19.399: E/AndroidRuntime(277): at java.lang.reflect.Method.invokeNative(Native Method)
08-31 18:37:19.399: E/AndroidRuntime(277): at java.lang.reflect.Method.invoke(Method.java:521)
08-31 18:37:19.399: E/AndroidRuntime(277): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-31 18:37:19.399: E/AndroidRuntime(277): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-31 18:37:19.399: E/AndroidRuntime(277): at dalvik.system.NativeStart.main(Native Method)
I'm trying Android 2.2. Is this an issue? Or anything I missed? Can someone guide me please.
The Facebook SDK requires a minimum Android API version 15 (Android 4.0.3, or ICE CREAM SANDWICH).
https://developers.facebook.com/docs/android
I'm trying Android 2.2. Is this an issue?
Yes, since FB 4.5.1 SDK required API 9 to run (that is Android 2.3). You can check it here: https://web.archive.org/web/20150821025823/https://developers.facebook.com/docs/android
Requires Android API 9.
It can't be run on previous Android versions since it uses new API methods/fields (in your case exception is caused by accessing the Locale.ROOT constant which was added only in API 9).
Starting from version 4.6.0 FB SDK started to require API 15:
https://developers.facebook.com/docs/android/upgrading-4.x
Related
I have android app in market so I get this error but I don't know why.
Exception class java.lang.NoClassDefFoundError
Source method MainActivity.onCreate()
java.lang.NoClassDefFoundError: android.app.DownloadManager
at com.example.viewpagerexample.MainActivity.onCreate(MainActivity.java:182)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1069)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
at android.app.ActivityThread.access$2300(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:144)
at android.app.ActivityThread.main(ActivityThread.java:4937)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
DownloadManager was added on API level 9 (aka Gingerbread).
My guess you declared minSDK as lower than 9 in your AndroidManifest.xml
If that is the case, you need to devise a workaround for users using older Android version.
You can check on which version your app is running by using the following code:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
// Use DownloadManager
}
else {
// Workaround
}
i'm getting this message when i run my application i don't know why i'm getting it could any one help me. here is the logcat.
java.lang.VerifyError: com.kosh.me.Smaller
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1429)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
at dalvik.system.NativeStart.main(Native Method)
This happens when the build library classes conflict with those at run-time. Try performing a Clean of your project followed by a build.
Trying to develop hello world, but getting force close error on emulator. thanks in advance
07-25 12:04:12.308: D/AndroidRuntime(277): Shutting down VM
07-25 12:04:12.308: W/dalvikvm(277): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
07-25 12:04:12.368: E/AndroidRuntime(277): FATAL EXCEPTION: main
07-25 12:04:12.368: E/AndroidRuntime(277): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.exampe.helloww/com.exampe.helloww.HelloActivity}: java.lang.ClassNotFoundException: com.exampe.helloww.HelloActivity in loader dalvik.system.PathClassLoader[/data/app/com.exampe.helloww-2.apk]
07-25 12:04:12.368: E/AndroidRuntime(277): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.os.Handler.dispatchMessage(Handler.java:99)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.os.Looper.loop(Looper.java:123)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-25 12:04:12.368: E/AndroidRuntime(277): at java.lang.reflect.Method.invokeNative(Native Method)
07-25 12:04:12.368: E/AndroidRuntime(277): at java.lang.reflect.Method.invoke(Method.java:521)
07-25 12:04:12.368: E/AndroidRuntime(277): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-25 12:04:12.368: E/AndroidRuntime(277): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-25 12:04:12.368: E/AndroidRuntime(277): at dalvik.system.NativeStart.main(Native Method)
07-25 12:04:12.368: E/AndroidRuntime(277): Caused by: java.lang.ClassNotFoundException: com.exampe.helloww.HelloActivity in loader dalvik.system.PathClassLoader[/data/app/com.exampe.helloww-2.apk]
07-25 12:04:12.368: E/AndroidRuntime(277): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
07-25 12:04:12.368: E/AndroidRuntime(277): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
07-25 12:04:12.368: E/AndroidRuntime(277): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
07-25 12:04:12.368: E/AndroidRuntime(277): ... 11 more
07-25 12:04:17.158: I/Process(277): Sending signal. PID: 277 SIG: 9
the ClassNotFoundException is usually caused when you try to run your app on lower sdk version than the target sdk
Add your HelloActivity in Manifest file.Due to this your Activity is not found and you are getting ClassNotFoundException as
E/AndroidRuntime(277): Caused by: java.lang.ClassNotFoundException: com.exampe.helloww.HelloActivity
I have a problem.
When I updated Android SDK tool to version 17 and the ADT to 17 I can't use ksoap2 any more.
I start the app and get this error:
03-25 20:13:49.995: E/AndroidRuntime(555): FATAL EXCEPTION: main
03-25 20:13:49.995: E/AndroidRuntime(555): java.lang.NoClassDefFoundError: org.ksoap2.serialization.SoapObject
03-25 20:13:49.995: E/AndroidRuntime(555): at com.alcad.pernat.praksa.SplashScreen.pridobiDanasnjo(SplashScreen.java:124)
03-25 20:13:49.995: E/AndroidRuntime(555): at com.alcad.pernat.praksa.SplashScreen.onCreate(SplashScreen.java:73)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.os.Handler.dispatchMessage(Handler.java:99)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.os.Looper.loop(Looper.java:123)
03-25 20:13:49.995: E/AndroidRuntime(555): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-25 20:13:49.995: E/AndroidRuntime(555): at java.lang.reflect.Method.invokeNative(Native Method)
03-25 20:13:49.995: E/AndroidRuntime(555): at java.lang.reflect.Method.invoke(Method.java:521)
03-25 20:13:49.995: E/AndroidRuntime(555): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-25 20:13:49.995: E/AndroidRuntime(555): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-25 20:13:49.995: E/AndroidRuntime(555): at dalvik.system.NativeStart.main(Native Method)
I should get String with some numbers but instead I get this error.
I was using ksoap2-2.5.4.jar and tried the new ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar.
I'm using Eclipse indigo, Ubuntu 11.04.
The code looks like this:
SoapObject Request =new SoapObject(NAMESPACE,METHOD_NAME); // Here I get the error
SoapSerializationEnvelope soapEnvelope=new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet=false;
String tmp=odstejDatum(datum);
Request.addProperty("datumod",tmp);
Request.addProperty("datumdo",datum);
Request.addProperty("tip_lme",1);
#SuppressWarnings("deprecation")
HttpTransportSE aht=new HttpTransportSE(URL,5000);
soapEnvelope.setOutputSoapObject(Request);
//
aht.call(SOAP_ACTION_DANASNJI,soapEnvelope);
Object response= soapEnvelope.getResponse();
Thanks for the help.
Android SDK tool to version 17 and the ADT to 17 they changed lib structure more details.
Here is the fix:
Remove the "ksoap2-android-assembly-2.6.2-jar-with-dependencies.jar"
from the build path.
copy the jar file into libs folder
(if not exist create it), then remove jar file from your folder(if you have custom jar folder in your project).
it will automatically take it in the build path.then, clean your project and run.
I am getting this error in my application, and this happens only on UPC300-2.2 Viewsonic G-Tablet. All answers I've found so far (including this one) adviced on putting
<uses-permission android:name="android.permission.INTERNET"/>
to the manifest file, but it doesn't help.
Here is the complete stacktrace:
java.lang.NoClassDefFoundError: android.net.NetworkConnectivityListener
at
com.google.android.maps.MapActivity.onCreate(MapActivity.java:199)
at
myapp.Activity.ActivityMapSearch.onCreate(ActivityMapSearch.java:99)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at
android.app.ActivityThread.access$2300(ActivityThread.java:125)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at
android.os.Handler.dispatchMessage(Handler.java:99)
at
android.os.Looper.loop(Looper.java:123)
at
android.app.ActivityThread.main(ActivityThread.java:4627)
at
java.lang.reflect.Method.invokeNative(Native
Method) at
java.lang.reflect.Method.invoke(Method.java:521)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at
dalvik.system.NativeStart.main(Native
Method)
If that is TRUE, you can grab the source code of the class from the Android Source and add it yourself