简体   繁体   English

使用android-support-v4.jar转换为Dalvik格式失败,并出现错误1

[英]Conversion to Dalvik format failed with error 1 with android-support-v4.jar

I am trying add the facebook library to my Android project, a getting Conversion to Dalvik format failed with error 1 error. 我正在尝试将facebook库添加到我的Android项目中, 无法转换为Dalvik格式,错误为1 After searching, it seems that my problem is related to the android-support-v4.jar . 搜索后,看来我的问题与android-support-v4.jar有关

Both the jar appears in the facebook dependencies and in the dependencies in my project. 这两个jar都出现在facebook依赖项和我项目的依赖项中。 I deleted both jars and re-added one to the facebook library, but I still get the error. 我删除了两个罐子,然后将其中一个重新添加到了Facebook库,但是仍然收到错误消息。 Below is a screen shot to show where the dependencies are. 下面是显示依赖关系所在位置的屏幕截图。

Thanks. 谢谢。

在此处输入图片说明

You have a duplicated dependency issue. 您有重复的依存关系问题。

Remove the last dependency on the NCC project 删除对NCC项目的最后一个依赖

 android-support-v4.jar - /Users/Heather/Documents/workspace/facebook-android-sdk-3.0/facebook/libs

android-support-v4.jar is already provided by the FacebookSDK library project, therefore there's no need to reference it again on the main project FacebookSDK库项目已经提供了android-support-v4.jar,因此无需在主项目上再次引用它

I was having this problem too with an app that used Facebook SDK. 使用Facebook SDK的应用程序也遇到了这个问题。 I was trying all sorts of stuff, so I'm not sure what exactly fixed but here's settings that worked for me: 我正在尝试各种各样的东西,所以我不确定到底是什么固定的,但是下面的设置对我有用:

FacebookSDK > Properties > Java Build Path > Order and Export FacebookSDK>属性> Java构建路径>订购和导出

Android 2.2 - NOT CHECKED Android 2.2-未检查

Android Private Libraries - CHECKED Android私有库-已检查

Android Dependencies - CHECKED Android依赖关系-已检查

MyApp > Properties > Java Build Path > Order and Export MyApp>属性> Java构建路径>订购和导出

Android 4.2.2 - CHECKED Android 4.2.2-已检查

Android Private Libraries - CHECKED Android私有库-已检查

Android Dependencies - CHECKED Android依赖关系-已检查

In addition, I had done this before, not sure it mattered. 另外,我之前做过此事,不确定是否重要。 Reverted to Facebook SDK version 3.5 from 3.5.2. 从3.5.2恢复为Facebook SDK版本3.5。 Updated to latest ADT 22.2.1. 更新到最新的ADT 22.2.1。 Changed Facebook SDK to use Android 2.2 from 4.2.2. 将Facebook SDK从4.2.2。更改为使用Android 2.2。

Sometimes the error is caused due to the permissions also. 有时错误也是由于权限引起的。 Check if you have declared multiple permissions in your manifest file. 检查清单文件中是否已声明多个权限。 Delete the extraneous permission from the file. 从文件中删除多余的权限。

This worked for me : 这为我工作:

this is a typical manifest file for facebookSDK based app 这是基于facebookSDK的应用程序的典型清单文件

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

    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="17" />

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:permission="android.permission.ACCESS_CHECKIN_PROPERTIES"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.devey.androidnativeapp.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/app_id" />

        <activity android:name="com.facebook.LoginActivity" >
        </activity>
        <activity
            android:name="com.devey.androidnativeapp.Testnative"
            android:label="@string/title_activity_testnative" >
        </activity>
    </application>

</manifest>

I deleted this extra permission and clean build my app with no further errors : 我删除了此额外权限,并干净构建了我的应用,没有其他错误:

android:permission="android.permission.ACCESS_CHECKIN_PROPERTIES" android:permission =“ android.permission.ACCESS_CHECKIN_PROPERTIES”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM