Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File not found on Xiaomi6, Android7.1.1, the solution in issue41 doesn't work #62

Open
joyzhou28 opened this issue Oct 31, 2017 · 7 comments

Comments

@joyzhou28
Copy link

Crashed in Xiaomi-6. The same problem in issue41 was solved. Although I adopt the this solution, allowing the permission of caffe-android-demo, the error still exists.
screenshot_2017-10-31-14-43-59-531_com miui bugreport

And the build.gradle is
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.sh1r0.caffe_android_demo"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
}

@great1319
Copy link

Hello~
Do you solve this problem ? I meet the same problem.

@joyzhou28
Copy link
Author

I got root privilege, problem solved

@great1319
Copy link

Excuse me , Have another solution?

@joyzhou28
Copy link
Author

I think you should make it clear why "File not found". For my mobile phone, although I have opened the permission for the app in Setting, without root permission, file still cannot be access.

@jimbochou77
Copy link

If running on Android >= 6.0, you should be granting permissions in the code in addition to the manifest.

Before you attempt to read the files, you need something like below. It's not perfect but it will check for the required permissions and log the result to console (0 for ok, -1 for not ok). It will also request the permissions from the user.

        int permissionCheckStorage = ContextCompat.checkSelfPermission(this.getApplicationContext(),
                Manifest.permission.WRITE_EXTERNAL_STORAGE);
        Log.d(LOG_TAG, "permissionCheck WRITE_EXTERNAL_STORAGE = " + permissionCheckStorage);
        int permissionCheckCamera = ContextCompat.checkSelfPermission(this.getApplicationContext(),
                Manifest.permission.CAMERA);
        Log.d(LOG_TAG, "permissionCheck CAMERA = " + permissionCheckCamera);

        ActivityCompat.requestPermissions(this,
                new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA},
                MY_PERMISSIONS_REQUEST_WRITE_EXTERNAL_STORAGE_AND_CAMERA);

@great1319
Copy link

My cellphone is Android 7.0 and API 24. I have checked the permission .Both camera and external storage have gotten the permission. But it doesn't work .
Check failed: fd != -1 (-1 vs. -1) File not found: /storage/emulated/0/caffe_mobile/bvlc_reference_caffenet/deploy.prototxt

And I find something in this project ,like below.Is it an error?
image

@joyzhou28
Copy link
Author

I've successfully run this demo both on cpu-mode and gpu-mode, the error you displayed above always exists. When running, it would call JNI functions packaged in dynamic library. Check the path and acquire root permission.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants