Conversion to Dalvik format failed with error 1 with android

I am trying add the facebook library to my Android project, a getting Conversion to Dalvik format failed with error 1 error. After searching, it seems that my problem is related to the android-support-v4.jar .

Both the jar appears in the facebook dependencies and in the dependencies in my project. I deleted both jars and re-added one to the facebook library, but I still get the error. 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

 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


I was having this problem too with an app that used 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

Android 2.2 - NOT CHECKED

Android Private Libraries - CHECKED

Android Dependencies - CHECKED

MyApp > Properties > Java Build Path > Order and Export

Android 4.2.2 - CHECKED

Android Private Libraries - CHECKED

Android Dependencies - CHECKED

In addition, I had done this before, not sure it mattered. Reverted to Facebook SDK version 3.5 from 3.5.2. Updated to latest ADT 22.2.1. Changed Facebook SDK to use Android 2.2 from 4.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

    <?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"

链接地址: http://www.djcxy.com/p/74598.html

上一篇: 转换为Dalvik格式失败,错误1在Android中

下一篇: 转换为Dalvik格式失败,出现错误1与android