问题
I am trying to get the HelloWebView Sample up and running (as is, with no cuustomizations) found at
http://developer.android.com/resources/tutorials/views/hello-webview.html
I continue to get java.lang.SecurityException: Permission Denial despite all efforts. In my mind this has got to be some fundamental lack of understanding on my part (I am a newbie) or something perhaps local to my development environment (Windows XP).
I have included my main.xml, AndroidManifest.xml, and console output below.
Things tried so far:
- different api's (6,7)
- adding/verifying (I think :)) that "uses-permission android:name="android.permission.INTERNET"" has the correct syntax and location in my manifest.
- wiping emulator
- restarting eclipse, laptop etc.
- disabling my internet security
Any help would be greatly appreciated.
Thank you. Tim
my main xml is:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
my manifest file is:
<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">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".HelloWebView" android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
</activity>
</application>
Actual console output:
------------------------------
[2010-06-04 07:57:06 - HelloWebView] Android Launch!
[2010-06-04 07:57:06 - HelloWebView] adb is running normally.
[2010-06-04 07:57:06 - HelloWebView] Performing com.example.hellowebview.HelloWebView activity launch
[2010-06-04 07:57:06 - HelloWebView] Automatic Target Mode: launching new emulator with compatible AVD 'AndroidGM2.1'
[2010-06-04 07:57:06 - HelloWebView] Launching a new emulator with Virtual Device 'AndroidGM2.1'
[2010-06-04 07:57:08 - HelloWebView] New emulator found: emulator-5554
[2010-06-04 07:57:08 - HelloWebView] Waiting for HOME ('android.process.acore') to be launched...
[2010-06-04 07:57:34 - HelloWebView] WARNING: Application does not specify an API level requirement!
[2010-06-04 07:57:34 - HelloWebView] Device API version is 7 (Android 2.1)
[2010-06-04 07:57:34 - HelloWebView] HOME is up on device 'emulator-5554'
[2010-06-04 07:57:34 - HelloWebView] Uploading HelloWebView.apk onto device 'emulator-5554'
[2010-06-04 07:57:35 - HelloWebView] Installing HelloWebView.apk...
[2010-06-04 07:57:46 - HelloWebView] Success!
[2010-06-04 07:57:47 - HelloWebView] Starting activity com.example.hellowebview.HelloWebView on device
[2010-06-04 07:57:55 - HelloWebView] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.hellowebview/.HelloWebView }
[2010-06-04 07:57:55 - HelloWebView] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.example.hellowebview/.HelloWebView } from null (pid=-1, uid=-1) requires null
回答1:
You have two entries in your manifest file for your HelloWebView activity. Try removing the second.
回答2:
Hi Tim this would exception is related to API Version, for example I use Android 1.5 so I add to my AndroidManifest.xml file
<uses-sdk android:minSdkVersion="3" />
check your messages output...
[2010-06-04 07:57:34 - HelloWebView] WARNING: Application does not specify an API level requirement!
[2010-06-04 07:57:34 - HelloWebView] Device API version is 7 (Android 2.1)
I have realized that the problem is that you have defined two activities (HelloWebView) into your Manifest.xml, you have to remove one of them.
<activity android:name=".HelloWebView"
来源:https://stackoverflow.com/questions/2974261/hellowebview-sample-java-lang-securityexception-permission-denial