深度链接错误android

rie

我试图构建一个手电筒应用程序,但是当我尝试运行它时,该应用程序停止了并给了我这个错误:

 03-20 12:18:39.590      437-455/system_process I/PackageManager﹕ Removing non-system package:com.example.flashlight
03-20 12:18:39.840      437-455/system_process I/PackageManager﹕ Running dexopt on: com.example.flashlight
03-20 12:18:46.340  24099-24099/com.example.flashlight E/Trace﹕ error opening trace file: No such file or directory (2)
03-20 12:18:46.360  24099-24099/com.example.flashlight W/dalvikvm﹕ Refusing to reopen boot DEX '/system/framework/hwframework.jar'
03-20 12:18:46.760  24099-24099/com.example.flashlight W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41d7e438)

这是我的代码:

public class MyActivity extends Activity {
    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Camera cam = android.hardware.Camera.open();
        Camera.Parameters parameters = cam.getParameters();
       ToggleButton toggleButton = (ToggleButton)findViewById(R.id.toggleButton);
        try {
            if (toggleButton.isChecked()){
                parameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH);
            } else {
                parameters.setFlashMode(Camera.Parameters.FLASH_MODE_OFF);
            }
        } catch (Exception e){
            e.printStackTrace();
        }

我的main.xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
        >
    <ToggleButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New ToggleButton"
            android:id="@+id/toggleButton" android:layout_centerVertical="true" android:layout_centerHorizontal="true"/>
</RelativeLayout>

和我的manifest.xml:

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

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

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

    <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
        <activity android:name="MyActivity"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>

我知道深层链接错误与互联网有关,但我在应用程序中没有类似的内容。请帮忙,因为我无法弄清楚这段代码出了什么问题。

瓦加尔·艾哈迈德(Waqar Ahmed)

您不添加权限即可使用camera.添加权限,然后重试。

添加这些

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

供参考,请参见此处:http : //developer.android.com/reference/android/hardware/Camera.html

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Android深度链接:对应用程序和Play商店使用相同的链接

来自分类Dev

深度链接iOS推送通知

来自分类Dev

Facebook与iOS应用深度链接

来自分类Dev

Ember JS深度链接

来自分类Dev

在Android中进行深度链接是否需要主机配置?

来自分类Dev

来自Android终端的URL方案/深度链接测试

来自分类Dev

不满意的链接错误:Android JNI

来自分类Dev

Android深度链接不适用于多种方案

来自分类Dev

Android深度链接到Instagram应用

来自分类Dev

Android OCR:不满意的链接错误

来自分类Dev

Android活动启动模式和深度链接问题

来自分类Dev

Firebase深度链接短网址

来自分类Dev

从应用程序打开android深度链接

来自分类Dev

Electron JS-深度链接-如何使用深度链接的示例

来自分类Dev

如何处理Android应用程序的多个深度链接

来自分类Dev

遍历TypeScript类型级链接列表,而不会出现深度错误

来自分类Dev

SFML Android链接器错误

来自分类Dev

Android上的Casablanca链接器错误

来自分类Dev

Android NDK:不满意的链接错误

来自分类Dev

深度链接到Android应用

来自分类Dev

从应用程序打开android深度链接

来自分类Dev

深度链接Facebook android / ios问题

来自分类Dev

C ++深度复制链接列表

来自分类Dev

如何在我的 Android 应用中实现深度链接

来自分类Dev

解决Android studio中的资源链接错误

来自分类Dev

Xamarin 深度链接问题

来自分类Dev

Android iOS 深度链接,一个域,多个应用

来自分类Dev

Android 资源链接失败(错误:链接引用失败。)

来自分类Dev

为 Android Facebook Lite 用户深度链接到 Facebook 群组