Hi all I have looked at the tutorial for creating tab layout on android on here:
link
which didn't work so I looked on here to find that there where errors with it. So I applied these and still I'm not getting anywhere with it.
The app loads on 2.1 emulator on eclipse and also on my phone but the application force closes each time which leads me to think that its a manifest problem.
Here is my manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.Android.fitnessap"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".TabLayout"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".HomeActivity"/>
<activity android:name=".HistoryActivity"/>
<activity android:name=".SettingsActivity"/>
</application>
<uses-sdk android:minSdkVersion="7" />
</manifest>
I've been stuck on this for hours now.
Thanks.
edit logcat:
01-19 18:37:09.316: ERROR/AndroidRuntime(126): ERROR: thread attach failed
01-19 18:37:10.945: ERROR/MediaPlayerService(31): Couldn't open fd for content://settings/system/notification_sound
01-19 18:37:10.955: ERROR/MediaPlayer(52): Unable to to create media player
01-19 18:37:15.345: ERROR/AndroidRuntime(170): ERROR: thread attach failed
01-19 18:37:17.215: ERROR/AndroidRuntime(197): Uncaught handler: thread main exiting due to uncaught exception
01-19 18:37:17.315: ERROR/AndroidRuntime(197): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.Android.fitnessap/com.Android.fitnessap.TabLayout}: java.lang.ClassNotFoundException: com.Android.fitnessap.TabLayout in loader dalvik.system.PathClassLoader#43b868e0
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2417)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.os.Handler.dispatchMessage(Handler.java:99)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.os.Looper.loop(Looper.java:123)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.app.ActivityThread.main(ActivityThread.java:4363)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at java.lang.reflect.Method.invokeNative(Native Method)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at java.lang.reflect.Method.invoke(Method.java:521)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at dalvik.system.NativeStart.main(Native Method)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): Caused by: java.lang.ClassNotFoundException: com.Android.fitnessap.TabLayout in loader dalvik.system.PathClassLoader#43b868e0
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2409)
01-19 18:37:17.315: ERROR/AndroidRuntime(197): ... 11 more
01-19 18:37:17.375: ERROR/dalvikvm(197): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
for a template on tabview that will work out of the box. Your manifest seems ok (but I'm not that good at android yet), so I would suggest using logcat to figure out what's up. In Eclipse, Window > Show View > Other.. and Under Android select logcat. Now run your app again and watch the ouptut of logcat for errors. It is a very good way to debug your app, just look for red exceptions and follow the ones related to your source code.
Related
I am having a class
public class GameActivity extends Activity implements
GLSurfaceView.Renderer, OnTouchListener{
The code does not have any problems, all needed methods are implemented. When I start the Activity it crashes with the following message:
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{[left out].GameActivity}:
java.lang.ClassNotFoundException: Didn't find class "...GameActivity"
on path [...]
I want to integreate the Google Game Service and Achievements in my game. Therefore I added the libary project and the GameBaseUtils as projects and also checkt that they should be exported inside my generated apk file. It compiles, the .jar for the google play services is also uploaded and will b e found. All includes are working. But when I start the game, it crashed immediately with the error message above.
I followed the tutorials on developers.android.com https://developers.google.com/games/services/android/init
Can someone tell me what I am doing wrong? Here is my Manifest
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package=""
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<!--
Tell the market, that the the app requires at least OpenGLES 2.0
This is not really the truth but it will decrease the rate of error
-->
<uses-feature android:glEsVersion="0x00020000"
android:required="true" />
<!-- Maybe not neccessary -->
<!-- <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/> -->
<application
android:allowBackup="true"
android:icon="#drawable/launcher_icon"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="sensorLandscape" >
<meta-data android:name="com.google.android.gms.games.APP_ID"
android:value="13465798" />
<activity
android:name="GameActivity"
android:screenOrientation="sensorLandscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- For the implementation of Adds in this App -->
</application>
</manifest>
Edit: Locat output
07-21 01:13:47.730: W/dalvikvm(22578): Unable to resolve superclass of
LGameActivity; (1182) 07-21 01:13:47.730:
W/dalvikvm(22578): Link of class
'L/GameActivity;' failed 07-21 01:13:47.730:
D/AndroidRuntime(22578): Shutting down VM 07-21 01:13:47.730:
W/dalvikvm(22578): threadid=1: thread exiting with uncaught exception
(group=0x4159f930) 07-21 01:13:47.746: E/AndroidRuntime(22578): FATAL
EXCEPTION: main 07-21 01:13:47.746: E/AndroidRuntime(22578):
java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{GameActivity}:
java.lang.ClassNotFoundException: Didn't find class
"GameActivity" on path:
.apk 07-21 01:13:47.746:
E/AndroidRuntime(22578): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
07-21 01:13:47.746: E/AndroidRuntime(22578): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
07-21 01:13:47.746: E/AndroidRuntime(22578): at
android.app.ActivityThread.access$600(ActivityThread.java:141) 07-21
01:13:47.746: E/AndroidRuntime(22578): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
07-21 01:13:47.746: E/AndroidRuntime(22578): at
android.os.Handler.dispatchMessage(Handler.java:99) 07-21
01:13:47.746: E/AndroidRuntime(22578): at
android.os.Looper.loop(Looper.java:137) 07-21 01:13:47.746:
E/AndroidRuntime(22578): at
android.app.ActivityThread.main(ActivityThread.java:5041) 07-21
01:13:47.746: E/AndroidRuntime(22578): at
java.lang.reflect.Method.invokeNative(Native Method) 07-21
01:13:47.746: E/AndroidRuntime(22578): at
java.lang.reflect.Method.invoke(Method.java:511) 07-21 01:13:47.746:
E/AndroidRuntime(22578): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
07-21 01:13:47.746: E/AndroidRuntime(22578): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 07-21
01:13:47.746: E/AndroidRuntime(22578): at
dalvik.system.NativeStart.main(Native Method) 07-21 01:13:47.746:
E/AndroidRuntime(22578): Caused by: java.lang.ClassNotFoundException:
Didn't find class "GameActivity" on path:
-1.apk 07-21 01:13:47.746:
E/AndroidRuntime(22578): at
dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
07-21 01:13:47.746: E/AndroidRuntime(22578): at
java.lang.ClassLoader.loadClass(ClassLoader.java:501) 07-21
01:13:47.746: E/AndroidRuntime(22578): at
java.lang.ClassLoader.loadClass(ClassLoader.java:461) 07-21
01:13:47.746: E/AndroidRuntime(22578): at
android.app.Instrumentation.newActivity(Instrumentation.java:1054)
07-21 01:13:47.746: E/AndroidRuntime(22578): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
07-21 01:13:47.746: E/AndroidRuntime(22578): ... 11 more
I've found the error:
I had to mark both projects I am using for the app (GameBaseUtils and google-play-services_lib) as a libary project and add them to android libaries I want to use. The rest is handled by android on its own.
I have problem with my app, everything was working fine yesterday but today I updated sdk and now when I'm trying to run my app I'm getting errors like this
05-21 00:14:19.285: W/dalvikvm(7061): Unable to resolve superclass of Lcom/lpp/towndefence/MainMenuActivity; (122)
05-21 00:14:19.285: W/dalvikvm(7061): Link of class 'Lcom/lpp/towndefence/MainMenuActivity;' failed
05-21 00:14:19.285: D/AndroidRuntime(7061): Shutting down VM
05-21 00:14:19.285: W/dalvikvm(7061): threadid=1: thread exiting with uncaught exception (group=0x40018560)
05-21 00:14:19.345: E/AndroidRuntime(7061): FATAL EXCEPTION: main
05-21 00:14:19.345: E/AndroidRuntime(7061): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.lpp.towndefence/com.lpp.towndefence.MainMenuActivity}: java.lang.ClassNotFoundException: com.lpp.towndefence.MainMenuActivity in loader dalvik.system.PathClassLoader[/data/app/com.lpp.towndefence-1.apk]
05-21 00:14:19.345: E/AndroidRuntime(7061): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1679)
05-21 00:14:19.345: E/AndroidRuntime(7061): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1783)
05-21 00:14:19.345: E/AndroidRuntime(7061): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
05-21 00:14:19.345: E/AndroidRuntime(7061): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:938)
05-21 00:14:19.345: E/AndroidRuntime(7061): at android.os.Handler.dispatchMessage(Handler.java:99)
05-21 00:14:19.345: E/AndroidRuntime(7061): at android.os.Looper.loop(Looper.java:130)
05-21 00:14:19.345: E/AndroidRuntime(7061): at android.app.ActivityThread.main(ActivityThread.java:3837)
05-21 00:14:19.345: E/AndroidRuntime(7061): at java.lang.reflect.Method.invokeNative(Native Method)
05-21 00:14:19.345: E/AndroidRuntime(7061): at java.lang.reflect.Method.invoke(Method.java:507)
05-21 00:14:19.345: E/AndroidRuntime(7061): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
05-21 00:14:19.345: E/AndroidRuntime(7061): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
05-21 00:14:19.345: E/AndroidRuntime(7061): at dalvik.system.NativeStart.main(Native Method)
05-21 00:14:19.345: E/AndroidRuntime(7061): Caused by: java.lang.ClassNotFoundException: com.lpp.towndefence.MainMenuActivity in loader dalvik.system.PathClassLoader[/data/app/com.lpp.towndefence-1.apk]
05-21 00:14:19.345: E/AndroidRuntime(7061): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
05-21 00:14:19.345: E/AndroidRuntime(7061): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
05-21 00:14:19.345: E/AndroidRuntime(7061): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
05-21 00:14:19.345: E/AndroidRuntime(7061): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
05-21 00:14:19.345: E/AndroidRuntime(7061): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1671)
05-21 00:14:19.345: E/AndroidRuntime(7061): ... 11 more
my manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lpp.towndefence"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="7"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:label="#string/app_name"
android:name=".MainMenuActivity" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".TownDefenseActivity">
</activity>
</application>
</manifest>
I cleaned project, fixed project properties but it didn't help.
Like #Barak said: jar files goes in libs directory. But make sure that libraries are checked at "project properties" -> "java build path" -> "order and export" too.
When i Try to run my app from both simulator and phys device it crashes, heres the log
I have phonegap 1.3.0 :)
01-12 14:13:51.742: W/dalvikvm(344): threadid=1: thread exiting with uncaught exception (group=0x40015560)
01-12 14:13:51.791: E/AndroidRuntime(344): FATAL EXCEPTION: main
01-12 14:13:51.791: E/AndroidRuntime(344): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.philipslighting.roadlight/com.philipslighting.roadlight.PhilipsRoadlightFinalActivity}: java.lang.ClassNotFoundException: com.philipslighting.roadlight.PhilipsRoadlightFinalActivity in loader dalvik.system.PathClassLoader[/data/app/com.philipslighting.roadlight-1.apk]
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.os.Handler.dispatchMessage(Handler.java:99)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.os.Looper.loop(Looper.java:123)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread.main(ActivityThread.java:3683)
01-12 14:13:51.791: E/AndroidRuntime(344): at java.lang.reflect.Method.invokeNative(Native Method)
01-12 14:13:51.791: E/AndroidRuntime(344): at java.lang.reflect.Method.invoke(Method.java:507)
01-12 14:13:51.791: E/AndroidRuntime(344): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-12 14:13:51.791: E/AndroidRuntime(344): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-12 14:13:51.791: E/AndroidRuntime(344): at dalvik.system.NativeStart.main(Native Method)
01-12 14:13:51.791: E/AndroidRuntime(344): Caused by: java.lang.ClassNotFoundException: com.philipslighting.roadlight.PhilipsRoadlightFinalActivity in loader dalvik.system.PathClassLoader[/data/app/com.philipslighting.roadlight-1.apk]
01-12 14:13:51.791: E/AndroidRuntime(344): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
01-12 14:13:51.791: E/AndroidRuntime(344): at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
01-12 14:13:51.791: E/AndroidRuntime(344): at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
01-12 14:13:51.791: E/AndroidRuntime(344): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
01-12 14:13:51.791: E/AndroidRuntime(344): ... 11 more
01-12 14:13:51.821: W/ActivityManager(61): Force finishing activity com.philipslighting.roadlight/.PhilipsRoadlightFinalActivity
01-12 14:13:52.341: W/ActivityManager(61): Activity pause timeout for HistoryRecord{4053ec18 com.philipslighting.roadlight/.PhilipsRoadlightFinalActivity}
01-12 14:13:53.151: I/Process(328): Sending signal. PID: 328 SIG: 9
01-12 14:13:53.181: I/ActivityManager(61): Process com.roadlight.philips (pid 328) has died.
01-12 14:13:54.331: I/Process(344): Sending signal. PID: 344 SIG: 9
01-12 14:13:54.371: W/InputManagerService(61): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#405c2d80
01-12 14:13:54.621: I/ActivityManager(61): Process com.philipslighting.roadlight (pid 344) has died.
here is my android manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.philipslighting.roadlight"
android:versionCode="4"
android:versionName="1.2" >
<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:resizeable="true"
android:anyDensity="true"
/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="#drawable/icon"
android:label="#string/app_name">
<activity
android:label="#string/app_name"
android:name=".activities.MainActivity"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Were in the activity tag would you you import the phone gap activity?
Thanks in advance !
It you have used this tutorial http://phonegap.com/start#android
then to fix java.lang.ClassNotFoundException as above you need to check the box next to cordova-XXX.jar in the "Order and Export" tab then you add a dependency for cordova-XXX.jar in Libraries tab at "Configure Build Path".
And of course mainclass's name must be correct at android:name="<main class name>".
I was following the phonegap droid getting started guide
In my case, I had created a folder called lib instead of libs. A symptom of this was that I had to manually add the jar to the build path. I removed the jar from the build path, renamed the lib folder to libs and things started working immediately.
In activity you import the file for PhoneGap please check it.
and see the index.html file in your folder.
I think just follow this path :
http://phonegap.com/start#android
See, video you will find solution for this.
<activity
android:label="#string/app_name"
android:name=".activities.MainActivity"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
you should mention with package name along with main class name in 'activity' tag,look at below example:
android:name="com.philipslighting.roadlight.MainActivity"
<activity
android:label="#string/app_name"
android:name="yourPACKAGEname.MainActivity"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
I have recently taken up Android Development and I was looking to using the WebView display webpages. I picked up from the sample that was given on Google site and for some reason the emulator kept saying page was not available. I searched in StackOverflow and found links relating to WebViewClient. I tried that also but no luck there, I have checked multiple times about the manifest entry for internet permission and its there. As a test I ran the browser available within the emulator and sure enough my firewall popped up a question on whether to allow it access or not. The pop up never came to me when I was running it from program. The code that I have is what is there Google pages
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://www.google.com");
mWebView.setWebViewClient(new HelloWebViewClient());
private class HelloWebViewClient extends WebViewClient {
#Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
I tried loading simple html directly using loadData and it worked fine. I am at loss as to what is happening and how this can be resolved. I would appreciate any help on this.
Adding the Android Manifest here
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellowebview"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".HelloWebView"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<uses-permission android:name="android.permission.INTERNET" />
</application>
</manifest>
To check if its just a WebView thingy, I tried accessing the internet using httpGet and httpResonse classes and got the same problem, the code was not able to connect to the given site. It failed stating the below
05-10 00:37:53.191: WARN/System.err(294): java.net.UnknownHostException: feeds.feedburner.com
05-10 00:37:53.230: WARN/System.err(294): at java.net.InetAddress.lookupHostByName(InetAddress.java:513)
05-10 00:37:53.230: WARN/System.err(294): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:278)
05-10 00:37:53.230: WARN/System.err(294): at java.net.InetAddress.getAllByName(InetAddress.java:242)
05-10 00:37:53.250: WARN/System.err(294): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:136)
05-10 00:37:53.250: WARN/System.err(294): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
05-10 00:37:53.250: WARN/System.err(294): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
05-10 00:37:53.271: WARN/System.err(294): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348)
05-10 00:37:53.271: WARN/System.err(294): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
05-10 00:37:53.280: WARN/System.err(294): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
05-10 00:37:53.291: WARN/System.err(294): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
05-10 00:37:53.301: WARN/System.err(294): at com.example.hellowebview.HelloWebView.onCreate(HelloWebView.java:43)
05-10 00:37:53.301: WARN/System.err(294): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-10 00:37:53.309: WARN/System.err(294): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-10 00:37:53.322: WARN/System.err(294): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-10 00:37:53.330: WARN/System.err(294): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-10 00:37:53.340: WARN/System.err(294): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-10 00:37:53.350: WARN/System.err(294): at android.os.Handler.dispatchMessage(Handler.java:99)
05-10 00:37:53.350: WARN/System.err(294): at android.os.Looper.loop(Looper.java:123)
05-10 00:37:53.361: WARN/System.err(294): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-10 00:37:53.361: WARN/System.err(294): at java.lang.reflect.Method.invokeNative(Native Method)
05-10 00:37:53.372: WARN/System.err(294): at java.lang.reflect.Method.invoke(Method.java:521)
05-10 00:37:53.380: WARN/System.err(294): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-10 00:37:53.380: WARN/System.err(294): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-10 00:37:53.401: WARN/System.err(294): at dalvik.system.NativeStart.main(Native Method)
05-10 00:37:56.773: WARN/ActivityManager(58): Launch timeout has expired, giving up wake lock!
05-10 00:37:58.083: WARN/ActivityManager(58): Activity idle timeout for HistoryRecord{44fc9108 com.example.hellowebview/.HelloWebView}
05-10 00:38:06.300: DEBUG/KeyguardViewMediator(58): pokeWakelock(5000)
05-10 00:38:06.651: INFO/ARMAssembler(58): generated scanline__00000077:03545404_00000004_00000000 [ 47 ipp] (67 ins) at [0x3724c8:0x3725d4] in 7266287 ns
05-10 00:38:06.720: INFO/ARMAssembler(58): generated scanline__00000177:03515104_00001001_00000000 [ 91 ipp] (114 ins) at [0x371380:0x371548] in 1486222 ns
05-10 00:38:30.430: DEBUG/AndroidRuntime(294): Shutting down VM
05-10 00:38:30.430: WARN/dalvikvm(294): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): FATAL EXCEPTION: main
05-10 00:38:30.752: ERROR/AndroidRuntime(294): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.hellowebview/com.example.hellowebview.HelloWebView}: java.lang.NullPointerException
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.os.Handler.dispatchMessage(Handler.java:99)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.os.Looper.loop(Looper.java:123)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at java.lang.reflect.Method.invokeNative(Native Method)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at java.lang.reflect.Method.invoke(Method.java:521)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at dalvik.system.NativeStart.main(Native Method)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): Caused by: java.lang.NullPointerException
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at com.example.hellowebview.HelloWebView.onCreate(HelloWebView.java:51)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-10 00:38:30.752: ERROR/AndroidRuntime(294): ... 11 more
Got it. For some reason the order in which the permission is set matters a lot. I changed the order of my permission setting in manifest file and it worked. Here's the modified manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellowebview"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".HelloWebView"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I am not sure what is the significance of this but would appreciate if anyone could elaborate.
Got it. For some reason the order in which the permission is set matters a lot. I changed the order of my permission setting in manifest file and it worked. Here's the modified manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.hellowebview"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".HelloWebView"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
mWebView = (WebView) findViewById(R.id.webview);
WebSettings setting =mWebView.getSettings();
mWebView.setWebViewClient(new WebViewClient() {
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return true;
}
mWebView.loadUrl("http://www.google.com");
Use this code .shouldOverrideUrlLoading() not use compulsary.use this code and please reply me this code work or not
Your code looks fine. I would make sure internet is working correctly on the emulator by browsing a few pages on the Android Browser. I have had problems before where the emulator would lose network access.
I have a working Android application. It works on more than 500 different devices. The manifest is
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="info.decamps.droid.photoid" android:versionCode="5"
android:versionName="1.4">
<application android:icon="#drawable/icon" android:label="#string/app_label"
android:name="PhotoIDroid" android:description="#string/app_desc"
android:debuggable="FALSE">
But when it it launched from a Samsung Galaxy Tab, it doesn't start and crashes with:
java.lang.RuntimeException: Unable to
instantiate application
info.decamps.droid.photoid.PhotoIDroid:
java.lang.ClassNotFoundException:
info.decamps.droid.photoid.PhotoIDroid
in loader
dalvik.system.PathClassLoader[/data/app/info.decamps.droid.photoid-1.apk]
at
android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:670)
at
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4483)
at
android.app.ActivityThread.access$3000(ActivityThread.java:135)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2181)
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) Caused by:
java.lang.ClassNotFoundException:
info.decamps.droid.photoid.PhotoIDroid
in loader
dalvik.system.PathClassLoader[/data/app/info.decamps.droid.photoid-1.apk]
at
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
at
java.lang.ClassLoader.loadClass(ClassLoader.java:573)
at
java.lang.ClassLoader.loadClass(ClassLoader.java:532)
at
android.app.Instrumentation.newApplication(Instrumentation.java:945)
at
android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:660)
... 11 more
How an the Samsung Galaxy not find the application class?
Any clue on how to resolve this?
I have been able to reproduce tis crash on the Samsung Galaxy emulator.
I have removed the android:name attribute declaration from the AndroidManifest.xml and it now works.