应用程序无法在牛轧糖中打开
App doesn't open in Nougat
我正在编写一个新的应用程序,我正在尝试使用不同的版本。当我在 Nougat 中尝试时,我的应用程序无法打开。它只是说:
app has stopped. Open app again?
如果我再次按下打开,应用程序会一直停止。
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 11
targetSdkVersion 25
versionCode 1
versionName "2.0"
multiDexEnabled true
}
}
我尝试使用 buildToolsVersion“25.0.1”,但没有。有帮助吗?
这是我尝试在 Nougat 设备中打开它时的 logcat 跟踪记录
05-10 09:49:35.119 4709-4709/app E/app: /storage/emulated/0/app/Registros/grupo-registros.csv (No such file or directory)
java.io.FileNotFoundException: /storage/emulated/0/app/Registros/grupo(demo)-registros.csv (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at java.io.FileOutputStream.<init>(FileOutputStream.java:140)
at app.MainActivity.onCreate(MainActivity.java:175)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
05-10 09:49:35.148 4709-4709/app D/AndroidRuntime: Shutting down VM
05-10 09:49:35.148 4709-4709/app E/AndroidRuntime: FATAL EXCEPTION: main
Process: app, PID: 4709
java.lang.RuntimeException: Unable to start activity ComponentInfo{es/app.MainActivity}: java.util.EmptyStackException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.util.EmptyStackException
at app.MainActivity.copyFileOrDir(MainActivity.java:434)
at app.MainActivity.addSubjectDemo(MainActivity.java:341)
at app.MainActivity.onCreate(MainActivity.java:231)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
编辑:我的清单许可请求
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
java.io.FileNotFoundException:/storage/emulated/0/app/Registros/grupo(demo)-registros.csv (No such file or directory)
发生这种情况可能是因为在 Nougat-Android 7.0 中,权限发生了变化,可能会影响您的应用。它不是强制执行的,但它会弹出您可能不处理的异常。您应该阅读文档:
https://developer.android.com/about/versions/nougat/android-7.0-changes.html
并检查这个答案
我正在编写一个新的应用程序,我正在尝试使用不同的版本。当我在 Nougat 中尝试时,我的应用程序无法打开。它只是说:
app has stopped. Open app again?
如果我再次按下打开,应用程序会一直停止。
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 11
targetSdkVersion 25
versionCode 1
versionName "2.0"
multiDexEnabled true
}
}
我尝试使用 buildToolsVersion“25.0.1”,但没有。有帮助吗?
这是我尝试在 Nougat 设备中打开它时的 logcat 跟踪记录
05-10 09:49:35.119 4709-4709/app E/app: /storage/emulated/0/app/Registros/grupo-registros.csv (No such file or directory)
java.io.FileNotFoundException: /storage/emulated/0/app/Registros/grupo(demo)-registros.csv (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
at java.io.FileOutputStream.<init>(FileOutputStream.java:140)
at app.MainActivity.onCreate(MainActivity.java:175)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
05-10 09:49:35.148 4709-4709/app D/AndroidRuntime: Shutting down VM
05-10 09:49:35.148 4709-4709/app E/AndroidRuntime: FATAL EXCEPTION: main
Process: app, PID: 4709
java.lang.RuntimeException: Unable to start activity ComponentInfo{es/app.MainActivity}: java.util.EmptyStackException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.util.EmptyStackException
at app.MainActivity.copyFileOrDir(MainActivity.java:434)
at app.MainActivity.addSubjectDemo(MainActivity.java:341)
at app.MainActivity.onCreate(MainActivity.java:231)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
编辑:我的清单许可请求
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MANAGE_DOCUMENTS" />
java.io.FileNotFoundException:/storage/emulated/0/app/Registros/grupo(demo)-registros.csv (No such file or directory)
发生这种情况可能是因为在 Nougat-Android 7.0 中,权限发生了变化,可能会影响您的应用。它不是强制执行的,但它会弹出您可能不处理的异常。您应该阅读文档:
https://developer.android.com/about/versions/nougat/android-7.0-changes.html
并检查这个答案