我的应用在发布时因此错误而崩溃。我在Manifest中获得了权限,因此我不确定发生了什么。
--------- beginning of crash
06-14 09:50:31.638 2550-2550/com.rebeccafuller.movienight E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.rebeccafuller.movienight, PID: 2550
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.rebeccafuller.movienight/com.rebeccafuller.movienight.ui.MainActivity}: java.lang.SecurityException: ConnectivityService: Neither user 10074 nor current process has android.permission.ACCESS_NETWORK_STATE.
这是我的Android Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rebeccafuller.movienight">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ui.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
答案 0 :(得分:0)
删除权限并尝试清理和构建..它将再次崩溃..然后再次添加这3个权限并执行。
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
它将解决您的问题