今天使用android+phonegap搭建环境,搞了一下午,都没弄出来,是根据http://www.phonegapcn.com/developers/get-started-13/get-started 这个教程来搭建的,真是郁闷死了?哪位牛人给点指点,本人没第一次搭建android平台
项目结构:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
package firstPhoneGap; import android.os.Bundle; import com.phonegap.DroidGap; public class App extends DroidGap{ @Override public void onCreate(Bundle b){ super .onCreate(b); super .loadUrl( "file:///android_asset/www/index.html" ); } } |
1
2
3
4
5
6
7
8
9
10
11
12
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> < html xmlns = "http://www.w3.org/1999/xhtml" > < head > < meta http-equiv = "Content-Type" content = "text/html; charset=gbk" /> < meta name = "viewport" content = "width=device-width, initial-scale=1" > < title >test</ title > < script type = "text/javascript" src = "phonegap-1.0.0.js" ></ script > </ head > < body > hello phoneGap! </ body > </ html > |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.firstphonegap" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> <supports-screens android:largeScreens="true" android:normalScreens="true" android:smallScreens="true" android:resizeable="true" android:anyDensity="true" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".test" android:label="@string/app_name" android:configChanges="orientation"> <intent-filter > <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> <activity android:name="com.phonegap.DroidGap" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden"> <intent-filter> </intent-filter> </activity> </application> </manifest> |
控制台信息:
[2014-05-07 16:39:21 - firstPhoneGap] ------------------------------
[2014-05-07 16:39:21 - firstPhoneGap] Android Launch!
[2014-05-07 16:39:21 - firstPhoneGap] adb is running normally.
[2014-05-07 16:39:21 - firstPhoneGap] Performing com.example.firstphonegap.test activity launch
[2014-05-07 16:39:21 - firstPhoneGap] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2014-05-07 16:39:24 - firstPhoneGap] Launching a new emulator with Virtual Device 'phoneGapAvd'
[2014-05-07 16:39:43 - firstPhoneGap] New emulator found: emulator-5554
[2014-05-07 16:39:43 - firstPhoneGap] Waiting for HOME ('android.process.acore') to be launched...
[2014-05-07 16:40:16 - firstPhoneGap] emulator-5554 disconnected! Cancelling 'com.example.firstphonegap.test activity launch'!
[2014-05-07 16:44:28 - firstPhoneGap] ------------------------------
[2014-05-07 16:44:28 - firstPhoneGap] Android Launch!
[2014-05-07 16:44:28 - firstPhoneGap] adb is running normally.
[2014-05-07 16:44:28 - firstPhoneGap] Performing com.example.firstphonegap.test activity launch
[2014-05-07 16:44:28 - firstPhoneGap] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2014-05-07 16:44:31 - firstPhoneGap] Launching a new emulator with Virtual Device 'phoneGapAvd'
[2014-05-07 16:44:49 - firstPhoneGap] New emulator found: emulator-5554
[2014-05-07 16:44:49 - firstPhoneGap] Waiting for HOME ('android.process.acore') to be launched...
[2014-05-07 16:45:16 - firstPhoneGap] emulator-5554 disconnected! Cancelling 'com.example.firstphonegap.test activity launch'!
[2014-05-07 17:02:45 - firstPhoneGap] ------------------------------
[2014-05-07 17:02:45 - firstPhoneGap] Android Launch!
[2014-05-07 17:02:45 - firstPhoneGap] adb is running normally.
[2014-05-07 17:02:45 - firstPhoneGap] Performing com.example.firstphonegap.test activity launch
[2014-05-07 17:02:45 - firstPhoneGap] Automatic Target Mode: Unable to detect device compatibility. Please select a target device.
[2014-05-07 17:02:49 - firstPhoneGap] Launching a new emulator with Virtual Device 'phoneGapAvd'
[2014-05-07 17:03:08 - firstPhoneGap] New emulator found: emulator-5554
[2014-05-07 17:03:08 - firstPhoneGap] Waiting for HOME ('android.process.acore') to be launched...
[2014-05-07 17:03:22 - firstPhoneGap] emulator-5554 disconnected! Cancelling 'com.example.firstphonegap.test activity launch'!
结果:Run as 弹出的AVD什么都没有!
请大神指点下!
Cordova App 实例: 一倍半 馋口街 中国电动车网