Access denied for property “vendor.camera.aux.packagelist”

做~自己de王妃 提交于 2019-12-24 04:06:33

问题


The application runs but when i try to use the camera only a disturbed grey screen appears and the logs tab gives me two errors:

E/libc: Access denied finding property "vendor.camera.aux.packagelist"
        Access denied finding property "vendor.camera.aux.packagelist2"

AndroidManifest.xml

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />

build.gradle (Module:app)

apply plugin: 'com.android.application'
android {
    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 22
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:28.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
}

build.gradle(Project:camera)

buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.0'
    }
}
allprojects {
    repositories {
        google()
        jcenter()

    }
}
task clean(type: Delete) {
    delete rootProject.buildDir
}


回答1:


First, check your Android version. If it is running on Android 6.0 and higher (API level 23+), then you need to :

Declare a permission in the app manifest. Make sure to insert the permission above the application tag.

<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />

<application ...>
    ...
</application>

Then, request that the user approve each permission at runtime

if (ContextCompat.checkSelfPermission(context, Manifest.permission.CAMERA) != 
PackageManager.PERMISSION_GRANTED) { 
ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.CAMERA}, 
50); }



回答2:


I had this in my android manifest that prevented the app from using the camera.

android:hardwareAccelerated="false"

Removing it helped me.



来源:https://stackoverflow.com/questions/55990262/access-denied-for-property-vendor-camera-aux-packagelist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!