Start a new topic

Cannot start Camera

Cannot start Camera


I tried to create a simpler version an get the same error.  Here's the simpler AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.greg.wikitudetest">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.location" android:required="true" />
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true" />
<uses-feature android:name="android.hardware.sensor.compass" android:required="true" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity"
android:configChanges="screenSize|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>

 

Hello,

I am able to successfully build and run the samples but i cannot get a bare-bones AR application working.  The app starts, the wikitude splash fades in and out but the camera never starts.  In the console i see the following errors:I/OpenGLRenderer:

D/libEGL: eglInitialize EGLDisplay = 0x9c7ff3cc
W/AudioCapabilities: Unsupported mime audio/mpeg-L1
W/AudioCapabilities: Unsupported mime audio/mpeg-L2
D/libEGL: eglInitialize EGLDisplay = 0xaddfa4c4
W/AudioCapabilities: Unsupported mime audio/x-ms-wma
W/AudioCapabilities: Unsupported mime audio/x-ima
W/CameraBase: An error occurred while connecting to camera: 0
E/libEGL: called unimplemented OpenGL ES API
W/VideoCapabilities: Unrecognized profile 2130706433 for video/avc
E/CameraPreviewBase: Exception on setting up Camera
                     java.lang.RuntimeException: Fail to connect to camera service
                         at android.hardware.Camera.<init>(Camera.java:568)
                         at android.hardware.Camera.open(Camera.java:405)
                         at com.wikitude.architect.CameraPreviewBase.j(ProGuard:471)
                         at com.wikitude.architect.CameraPreviewBase.getCamera(ProGuard:398)
                         at com.wikitude.architect.CameraPreviewBase.i(ProGuard:406)
                         at com.wikitude.architect.CameraPreviewBase.surfaceCreated(ProGuard:381)
                         at android.view.SurfaceView.updateWindow(SurfaceView.java:712)
                         at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:209)
                         at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:1014)
                         at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2510)
                         at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1437)
                         at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7397)
                         at android.view.Choreographer$CallbackRecord.run(Choreographer.java:920)
                         at android.view.Choreographer.doCallbacks(Choreographer.java:695)
                         at android.view.Choreographer.doFrame(Choreographer.java:631)
                         at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:906)
                         at android.os.Handler.handleCallback(Handler.java:739)
                         at android.os.Handler.dispatchMessage(Handler.java:95)
                         at android.os.Looper.loop(Looper.java:158)
                         at android.app.ActivityThread.main(ActivityThread.java:7225)
                         at java.lang.reflect.Method.invoke(Native Method)
                         at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
                         at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
W/VideoCapabilities: Unsupported mime video/wvc1
W/VideoCapabilities: Unsupported mime video/x-ms-wmv
W/DisplayListCanvas: DisplayListCanvas is started on unbinded RenderNode (without mOwningView)

My AndroidManifest.xml looks like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.greg.artest1">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<!-- Tell the system this app requires OpenGL ES 2.0. -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />

<!-- rear facing cam -->
<uses-feature android:name="android.hardware.camera" android:required="true" />

<!-- users location -->
<uses-feature android:name="android.hardware.location" android:required="true" />

<!-- accelerometer -->
<uses-feature android:name="android.hardware.sensor.accelerometer" android:required="true" />

<!-- compass -->
<uses-feature android:name="android.hardware.sensor.compass" android:required="true" />

<!-- do not support small resolution screens -->
<supports-screens
android:smallScreens="false" android:largeScreens="true"
android:normalScreens="true" android:anyDensity="true"
android:xlargeScreens="true" />

<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="21" />

</manifest>

 

and my main activity looks like this:

package com.example.greg.artest1;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.wikitude.architect.ArchitectView;
import com.wikitude.architect.StartupConfiguration;

import java.io.IOException;

public class MainActivity extends AppCompatActivity
{
private static final String TAG = MainActivity.class.getSimpleName();
protected boolean theIsLoadingFlag = false;
protected static final String WIKITUDE_SDK_KEY = "REDACTED";

ArchitectView theArchitectView;
StartupConfiguration theStartupConfiguration;

protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

this.theArchitectView = (ArchitectView)this.findViewById(R.id.architectView);
final StartupConfiguration config = new StartupConfiguration(WIKITUDE_SDK_KEY);
theArchitectView.onCreate(config);
}

protected void onPostCreate(final Bundle savedInstance)
{
super.onPostCreate(savedInstance);

if (theArchitectView != null)
{
theArchitectView.onPostCreate();

try
{
theArchitectView.load("index.html");
}
catch (IOException ioe)
{
ioe.printStackTrace();
}
}
}

public void onResume()
{
super.onResume();
theArchitectView.onResume();
}

protected void onPause()
{
super.onPause();

if (theArchitectView != null) {
theArchitectView.onPause();
}
}

protected void onStop()
{
super.onStop();
}

protected void onDestroy()
{
super.onDestroy();

if (theArchitectView != null) {
theArchitectView.onDestroy();
}
}

public void onLowMemory()
{
super.onLowMemory();

if (theArchitectView != null) {
theArchitectView.onLowMemory();
}
}
}


 

Any help is greatly appreciated.

 

thanks,

Greg

ok i figured it out.  For anyone else that has this problem there are two ways to fix it.  For me, the simple way was to just downgrade the targetedSkVersion to 21.  There was a tooltip i hadn't noticed in the AndroidManifest.xml that indicated the <uses-sdk> tag is ignored in favor of what's specified in gradle build script.  I didn't realize this was the case so that tag is not helpful so i had to just adjust the build and that did the trick.  the second way is to use the new permissions approach which you can see detailed here:  https://inthecheesefactory.com/blog/things-you-need-to-know-about-android-m-permission-developer-edition/en
Login or Signup to post a comment