0

I am new to android studio And I'm trying to import eclipse project in android with few dependent android projects.

Please see below attached image and my message console for the error. I have tried by changing API version to 24 which is latest nothing happen and again back to API 21 after one answer on SO. enter image description here Gradle version. In wrapper I've 2.14.1 and in file I've 2.1.3

build.gradle file

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "24.0.2"

    defaultConfig {
        applicationId "package.name"
        minSdkVersion 11
        targetSdkVersion 21
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile project(':comtwittersdkandroid_twitter')
    compile 'com.google.android.gms:play-services:+'
    compile 'com.android.support:appcompat-v7:21.2.0'
    compile files('libs/httpclient-4.3.3.jar')
    compile files('libs/httpcore-4.4.1.jar')
    compile files('libs/httpmime-4.3.jar')
    compile files('libs/twitter4j-core-3.0.5.jar')
    compile files('libs/universal-image-loader-1.8.0.jar')
    compile files('libs/zxing-1.7-core.jar')
    compile files('libs/zxing-integration.jar')
}

I've tried adding jar instead of compile statement, it's not working.

Any help will be appreciated, thanks in advance.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
MobileEvangelist
  • 2,583
  • 1
  • 25
  • 36

2 Answers2

0

Since you are using

compile 'com.google.android.gms:play-services:+'

you have a dependency with the support libraries v24 which require api 24 to compile.
You have to use:

compileSdkVersion 24
Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
0

Thanks for your help, I finally break into the issue that is I have to delete com_crashlytics_export_strings.xml file from my project. As I switch to API version 23 I removed http jars and added compile statements to build.gradle

One Important thing I've observed is "if you've dependent projects please cross check everything, as the main project mostly do not compile because of the issue with using same lib. in dependent projects or deprecated functions; as I have one for maps in one of my classes.

my build.gradle file

    apply plugin: 'com.android.application'

android {
    useLibrary 'org.apache.http.legacy'
    compileSdkVersion 'Google Inc.:Google APIs:23'
    buildToolsVersion '23.0.3'

    defaultConfig {
        applicationId "package-name"
        minSdkVersion 11
        targetSdkVersion 21
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {

    compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
    compile('org.apache.httpcomponents:httpmime:4.3.6')
    compile files('libs/universal-image-loader-1.8.0.jar')
    compile files('libs/zxing-1.7-core.jar')
    compile files('libs/zxing-integration.jar')
    compile files('libs/gcm.jar')
    compile 'com.google.android.gms:play-services:9.4.0'
    compile 'com.android.support:appcompat-v7:23.2.0'
}

Thanks for the help. Answer to help anybody who faces same issue in the future.

MobileEvangelist
  • 2,583
  • 1
  • 25
  • 36