当我在调试中运行我的应用时,.apk可以正常工作,但是当我发布.apk时,则我的应用在CAMERA活动时崩溃。
请让我知道该怎么办?
还请告诉我这又如何获得隐私权政策网址(如果应用程序具有摄像头并读取内部存储权限,则必须在Google Play商店上发布应用程序)。
@AfterPermissionGranted(RC_VIDEO_APP_PERM)
private void requestPermissions() {
String[] perms = { Manifest.permission.INTERNET, Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO };
if (EasyPermissions.hasPermissions(this, perms)) {
// if there is no server URL set
if (CHAT_SERVER_URL == null) {
// use hard coded session values
if (areHardCodedConfigsValid()) {
initializeSession(key, session, token);
} else {
showConfigError("Configuration Error",hardCodedConfigErrorMessage);
}
} else {
// otherwise initialize WebServiceCoordinator and kick off request for session data
// session initialization occurs once data is returned, in onSessionConnectionDataReady
if (isWebServerConfigUrlValid()) {
mWebServiceCoordinator = new WebServiceCoordinator(this, this);
mWebServiceCoordinator.fetchSessionConnectionData(SESSION_INFO_ENDPOINT);
} else {
showConfigError("Configuration Error", webServerConfigErrorMessage);
}
}
} else {
EasyPermissions.requestPermissions(this, getString(R.string.rationale_video_app), RC_VIDEO_APP_PERM, perms);
}
}
谢谢。
答案 0 :(得分:-1)
请分享您的密码。我认为您的问题出在许可中。您没有检查相机许可。请使用此代码来检查许可
@Override
public void onRequestPermissionsResult(int requestCode,
String permissions[], int[] grantResults) {
switch (requestCode) {
case MY_PERMISSIONS_REQUEST_READ_CONTACTS: {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// permission was granted, yay! do the
// calendar task you need to do.
} else {
// permission denied, boo! Disable the
// functionality that depends on this permission.
}
return;
}
// other 'switch' lines to check for other
// permissions this app might request
}
}