Topic has a solution and is locked
Log in or register to post comments

Android 6.0 - Camera Initialization failed

November 21, 2015 - 5:59am #1
Topic solved

Hi,

We have an issue similar to this post.

We are testing our app on Nexus 5X with Android 6.0 and the AR camera cannot be initialized. We tried to set <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="22">, but since our app is already available on Google Play Store (probably with targetSdkVersion="23"), the app cannot be installed:

"Failure [INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE]"

Is there any other solution to fix this ?

 

Thanks,

Jérémy.

Android 6.0 - Camera Initialization failed

January 16, 2018 - 11:25pm #19

How its work with https://mobile-phone-tracker.org/ mobile recorder on Android ?

Android 6.0 - Camera Initialization failed

January 18, 2017 - 8:50am #18

SOLUCIÓN AL PROBLEMA:

        minSdkVersion 14

        targetSdkVersion 23



EJEMPLO DE CÓDIGO:

public class login extends ActionBarActivity {

@Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

    ......

int currentapiVersion = android.os.Build.VERSION.SDK_INT;

        if(currentapiVersion >= Build.VERSION_CODES.M) {

            validarPermiso();

        }else {

            //LAS VERSIONES <= 22 NO NECESITAN LA VALIDACION

        }

......

}

@TargetApi(Build.VERSION_CODES.M)

    private void validarPermiso(){

        if (ContextCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {

            if (ActivityCompat.shouldShowRequestPermissionRationale(login.this,

                    Manifest.permission.CAMERA)) {

                Log.i("","NO LO DIO");

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

            }else {

                Log.i("","PEDIRLO");

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

            }

        }else {

            control_usuario.getInstance().permiteAccesoCAMARA = true;

        }

    }

    @Override

    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {

        switch (requestCode){

            case CAMERAPERMISO: {

                // If request is cancelled, the result arrays are empty.

                if (grantResults.length > 0

                        && grantResults[0] == PackageManager.PERMISSION_GRANTED) {

                    Log.i("","USUARIO PERMITE");



                } else {

                    Log.i("","USUARIO DENIEGA");

                    //MUESTRA MENSAJE

                    Toast.makeText(getApplicationContext(),"No podrá hacer uso de la su cámara",Toast.LENGTH_LONG).show();

                }

                return;

            }

        }

        super.onRequestPermissionsResult(requestCode, permissions, grantResults);

    }

}

 

MAYOR INFORMACIÓN Y REFERENCIA:

https://developer.android.com/training/permissions/requesting.html

Android 6.0 - Camera Initialization failed

June 16, 2016 - 12:30am #17

This works for me:

- Settings->Applications-> "uninstall app completely"

- Install app with android:targetSdkVersion="23" in manifest.xml

-Then: Settings->Applications-> "App details" -> allow camera and everything you need.

 

Good luck ;)

Android 6.0 - Camera Initialization failed

June 15, 2016 - 10:52pm #16

OMG! 

My app was built with Unity5.2.0f3 and the total project is based on AssetBundle loading.

its very pain to recreate the asset bundles for the latest Unity also it is similar to create the project from scratch. 

 

 

Is this "Failed to initialize vuforaia" problem will resolve if i click on "Allow" button on startup popUp in Android 6.0 and above ?

Please confirm the same.

 

 

Android 6.0 - Camera Initialization failed

June 15, 2016 - 1:15pm #15

Unity 5.2.4 made some fixes with regard to requesting permissions when app starts:

Android: Android 6.0 - Ask for any dangerous permission on startup. (739831), (732504)
Android: Fixed querying for custom permissions on Android Marshmallow. (750227)

https://unity3d.com/unity/whats-new/unity-5.2.4

 

Android 6.0 - Camera Initialization failed

June 15, 2016 - 4:00am #14

Hi dm3d,

Here is my App which needs access to (refer the attached image)

  • Photos/Media/Files
  • Camera
  • Device ID & call information 

Not asking any permissions like Allow / Deny after installing and opening for the first time (in all the devices). 

What we have to write to get Allow/Deny popup for the first time (or every time) opening after installing from play store. 

Also attaching Manifest screenshot.

 

This app is published on Playstore with TargetSDK 23. Now unable to update the app with TargetSDK with 22 to support Android 6 and Above. Our client dont want to publish with new bundle id. Please suggest.

 

To check (either asking for permissions or not) here is the app link.

 

AttachmentSize
Image icon ManifestScreen.png229.42 KB
Image icon Permissions.jpg227.21 KB

Android 6.0 - Camera Initialization failed

May 28, 2016 - 9:45am #13

Hey guys, I'm also currently facing the same problem with SDk23 crashing Vuforia on Android devices with 6.0 above! ANy of you guys found a solution so far?

Android 6.0 - Camera Initialization failed

May 6, 2016 - 1:40am #12

I have the same case. We had delivered an application to a high profile client last year. At that time we had used Unity 4.6 and Vuforia 3.0.9. Facing the same problem . Tried the following

a) . Built it as target SDK 23 - It gets published on Playstore but doesnt work with Android M. Its imply crashes on Android M.

b) . Built it as target SDK 2 - Works on Marshmallow but cant publish it as we all know already.

I also tried Unity 4.7 it says "

  • Android: Added support for Marshmallow OS runtime permissions. Added possibility to disable permission dialog by adding activity metadata.

"

and also the app simply crashes it doesnt ask for any permisiions where i can select allow...

Please Update me with the same as the app on playstore fails on Marshmallo which has caused inconvenience to them and I will have to provide a stable solution soon

Android 6.0 - Camera Initialization failed

April 29, 2016 - 5:47pm #11

The Google Play store is not the only channel that prevents you from loading an app update which uses a lower API version than the existing app which is being updated. This is also the same behavior when installing apks to a device with the command-line adb tool:

adb install apkWithLowerTargetAPI.apk

6214 KB/s (17051730 bytes in 2.679s)
    pkg: /data/local/tmp/apkWithLowerTargetAPI.apk
Failure [INSTALL_FAILED_PERMISSION_MODEL_DOWNGRADE]

A Unity Vuforia app with a targetSdkVersion="23" (i.e. Android 6.0) value set in the AndroidManifest.xml will prompt users with a permission dialog (seen above) when the app starts. If DENY is selected and Vuforia is started when the camera permission is in a DENIED state, a "Vuforia Initialization Error" dialog will appear on screen with the error message "Failed to initialize Vuforia" and a "Close" button at the bottom. Pressing the "Close" button will call Unity's Application.Quit() method. Restarting the app again after Application.Quit() was called will display the permission dialog again unless the "Never ask again" option was checked. *

You can determine if Vuforia has started and if the camera is active using the following:

CameraDevice.Instance.IsActive()
VuforiaAbstractBehaviour.HasStarted

If camera permissions are in a DENIED state, the isActive() method and HasStarted boolean will return False and you can then provide on-screen directions for the user to quit and restart the app and click ALLOW when the permission dialog presents itself again.

* If the user clicked DENY with the "Never ask again" checkbox enabled on the permissions dialog, then no more permissions dialog prompts will appear (this is also true in native Android). The user must manually go into settings and change the permissions at that point.

Please see this article for additional detail about how Android's permission requesting works:

http://developer.android.com/training/permissions/requesting.html
 

Android 6.0 - Camera Initialization failed

April 27, 2016 - 9:04am #10

We found ourselve in the same identical situation as  DP007, with an SDK23 version impossible to downgrade due to Unity policies, really tight deadlines and a big end customer ready to go mental if we require Androud 6 users to set permissions manually. 
If you guys get this fixed asap it would be EXTREMELY nice for us.

We edge on pushing the Panic button, a solution is welcome any time.
Cheers

Android 6.0 - Camera Initialization failed

April 27, 2016 - 5:59am #9

Hey Alessandro,

 

your solution may help for apps which where never published on playstore with target SDK 23. For all other cases, this solution doesn't work at all. We already have an AR app using vuforia on the playstore with tagret SDK version 23 and from google side it's absolutely restricted to upload an app with lower target SDK version (like 22 which may solve this bug). I guess the correct way to fix this issue is making vuforia work on target SDK version 23 to satisfy all of your customers not only a small portion of it which never released an AR app with version 23 on the play store, correct me if I'm wrong...When do you think we can expect an update of vuforia with the issue fixed??? We really need this update since we developed an app for a huge international customer and now the app isn't working anymore on android 6 devices and it's absolutely no way to upload it as new app with different bundle id.

We really need help on this topic, urgently.

 

Thanks in advance.

 

Android 6.0 - Camera Initialization failed

March 7, 2016 - 1:12pm #8

Add permission to Androidmanifest:

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

 

Android 6.0 - Camera Initialization failed

November 28, 2015 - 5:01am #7

Go it!!!!

 

It solved with changing "Bundle Indentifier" to another one :)

Android 6.0 - Camera Initialization failed

November 28, 2015 - 4:28am #6

Dear AlessandroB,

I got "INSTALL_FAILED_VERSION_DOWNGRADE" when I change the SDKversion to 22.

I increment   android:versionCode="2"  and android:versionName="2.1" in XML.

But I am getting same error again, again.... :(

Android 6.0 - Camera Initialization failed

November 28, 2015 - 4:19am #5

@onerhatipoglu:

in order to make your App work on Android 6 devices, you need to set the "targetSdkVersion" to "22" (or other value which is smaller then "23") in the AndroidManifest.XML of your App; this requirement is due to the new runtime camera permission feature introduced in API 23 (Android SDK 6.0);

in practice, this is done by adding a line like the following in your Android Manifest:

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="22" />

 

NOTE I:

in the line above, the minSdkVersion is set to 14 just as an example, but you can change it to whichever min Sdk version you want your App to support (for instance, "14" corresponds to Android 4.0 ICS).

 

NOTE II:

if you are developing in Unity, the line above must be entered in the AndroidManifest.XML file which is located in the 'Assets/Plugins/Android' folder of your Unity project.

This is also described in this thread:

https://developer.vuforia.com/forum/device-support/android-m-vuforia-initializing-failed

 

 

@EditionsMargot:

Concerning the other issue reported by the first poster (about getting "INSTALL_FAILED_VERSION_DOWNGRADE" error message due to App already in Play Store), this error message is typically generated when trying to upload an upgrade which has same or lower versionCode and/or versionName; to solve this, you need to make sure that the versionCode and versionName of your upgraded APK is higher than the one of the old APK already published;

see also:

http://stackoverflow.com/questions/24547924/android-install-failed-version-downgrade

 

 

Hope this helps.

 

Android 6.0 - Camera Initialization failed

November 28, 2015 - 3:06am #4

I have same problem to initialize Vuforia error at Nexus 5. Any solution?

Android 6.0 - Camera Initialization failed

November 23, 2015 - 5:31pm #3

Is this error appearing when trying to update app on Google Play Store or when you are using ADB to copy new .apk to the device?

Android 6.0 - Camera Initialization failed

November 23, 2015 - 4:06pm #2

I am also seeing this happen on my Nexus 6 with Android 6. I am guessing this is a compatibility issue with Android 6 since it is new.

Log in or register to post comments