0

我正在构建一个针对 Android 的所有设备的应用程序。但是我无法在 Nexus 7 上专门运行该应用程序。我已经检查了 stackoverflow 上存在的所有可能性,但我无法从这个问题中恢复过来。我在这里粘贴我的 AndroidManifest 文件。请查看并纠正我做错的地方。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xxxxxxxxxxxxx"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="15" />

<supports-screens
    android:anyDensity="true"
    android:largeScreens="true"
    android:normalScreens="true"
    android:resizeable="true"
    android:smallScreens="true" >
</supports-screens>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />

<!-- Mobclix Required Permissions -->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />

<!-- Mobclix Optional Permissions -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
    android:name=".AppSingleton"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Light.NoTitleBar" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".AppWidgetConfigure"
        android:screenOrientation="portrait" >
        <intent-filter>
            <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
        </intent-filter>
    </activity>

    <!-- widget stuff -->
    <receiver android:name=".MyAppWidgetProvider" >
        <intent-filter>
            <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
        </intent-filter>

        <meta-data
            android:name="android.appwidget.provider"
            android:resource="@xml/my_appwidget_info" />
    </receiver>

    <!-- Mobclix Required Parameter -->
    <meta-data
        android:name="com.mobclix.APPLICATION_ID"
        android:value="6D72xxxxx-xxxxxxxxxxxx-xxxxxxx" />

    <activity
        android:name="com.mobclix.android.sdk.MobclixBrowserActivity"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Translucent.NoTitleBar" />
    <activity
        android:name="UserPreference"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar" >
    </activity>
</application>

请给我一些建议。

DDMS 错误日志:

09-24 16:26:48.424: E/AndroidRuntime(2213): FATAL EXCEPTION: main 09-24 16:26:48.424: E/AndroidRuntime(2213): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.jutera.allsearch/com.jutera.allsearch.MainActivity}: java.lang.NullPointerException 09-24 16:26:48.424: E/AndroidRuntime(2213): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059) 09-24 16:26:48.424: E/AndroidRuntime(2213): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084) 09-24 16:26:48.424: E/AndroidRuntime(2213): at android.app.ActivityThread.access$600(ActivityThread.java:130) 09-24 16:26:48.424: E/AndroidRuntime(2213): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195) 09-24 16:26:48.424: E/AndroidRuntime(2213): at android.os.Handler.dispatchMessage(Handler.java:99) 09-24 16:26:48.424: E/AndroidRuntime(2213): at android.os.Looper.loop(Looper.java:137) 09-24 16:26:48.424: E/AndroidRuntime(2213): at android.app.ActivityThread.main(ActivityThread.java:4745) 09-24 16:26:48.424: E/AndroidRuntime(2213): at java.lang.reflect.Method.invokeNative(Native Method) 09-24 16:26:48.424: E/AndroidRuntime(2213): at java.lang.reflect.Method.invoke(Method.java:511) 09-24 16:26:48.424: E/AndroidRuntime(2213): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) 09-24 16:26:48.424: E/AndroidRuntime(2213): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 09-24 16:26:48.424: E/AndroidRuntime(2213): at dalvik.system.NativeStart.main(Native Method) 09-24 16:26:48.424: E/AndroidRuntime(2213): Caused by: java.lang.NullPointerException 09-24 16:26:48.424: E/AndroidRuntime(2213): at com.jutera.allsearch.MainActivity.connectionAvailable(MainActivity.java:748) 09-24 16:26:48.424: E/AndroidRuntime(2213): at com.jutera.allsearch.MainActivity.onCreate(MainActivity.java:159) 09-24 16:26:48.424: E/AndroidRuntime(2213): at android.app.Activity.performCreate(Activity.java:5008) 09-24 16:26:48.424: E/AndroidRuntime(2213): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079) 09-24 16:26:48.424: E/AndroidRuntime(2213): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023) 09-24 16:26:48.424: E/AndroidRuntime(2213): ... 11 more 09-24 16:26:51.684: D/dalvikvm(2213): GC_CONCURRENT freed 368K, 10% free 7726K/8519K, paused 12ms+12ms, total 46ms

4

2 回答 2

0

为我工作!我如何检查我的互联网连接存在一些问题。这是我解决的代码:

/**
 * Checking network state
 * */
public boolean connectionAvailable() {
    ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo activeNetworkInfo = connectivityManager
            .getActiveNetworkInfo();
    return activeNetworkInfo != null;
}
于 2012-11-15T06:32:33.387 回答
-1
<supports-screens android:normalScreens="true" android:resizeable="true" android:anyDensity="true" android:largeScreens="true" android:smallScreens="true" android:xlargeScreens="true"></supports-screens>

请参阅上面的代码并添加对 xlargeScreens 的支持!

于 2012-09-24T10:16:25.750 回答