相关文章推荐
刀枪不入的皮带  ·  android studio ...·  昨天    · 
从容的投影仪  ·  Azure Synapse RESTAPI ...·  11 月前    · 
任性的香瓜  ·  SQL Server - ...·  1 年前    · 
爱旅游的打火机  ·  MFC分组Radio ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I import project from eclipse to android studio, and got above message after Sync project with gradle files. I am new with android studio, don't know how to solve this error.

Following is the Gradle file.

apply plugin: 'com.android.application'
android {
    compileSdkVersion 19
    buildToolsVersion '19.1.0'
    defaultConfig {
        applicationId "com.s5.selfiemonkey1"
        minSdkVersion 14
        targetSdkVersion 14
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_6
        targetCompatibility JavaVersion.VERSION_1_6
    productFlavors {
dependencies {
    compile 'com.android.support:support-v4:18.0.0'
    compile 'com.google.android.gms:play-services:+'
    compile 'com.google.code.gson:gson:2.2.2'
    compile files('libs/AF-Android-SDK.jar')
    compile files('libs/AndroidSwipeLayout-v1.1.8.jar')
    compile files('libs/FlurryAnalytics-5.3.0.jar')
    compile files('libs/android-viewbadger.jar')
    compile files('libs/commons-codec-1.4.jar')
    compile files('libs/google-play-services.jar')
    compile files('libs/okhttp-2.5.0.jar')
    compile files('libs/okio-1.6.0.jar')
    compile files('libs/parcelgen.jar')
    compile files('libs/scribe-1.1.2.jar')

Build Gradle from Project

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        jcenter()
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
allprojects {
    repositories {
        jcenter()

Please advice. Thanks in advance.

Also one more thing Found out in project settings. In projects tab android plugin repository was set to mavencentral but default library repository was blank, making both same worked for me. – Charlie Sep 11, 2015 at 20:09 sorry, but I am completely unknown with android studio and gradle scripting. Where I can find base build.gradle. – Amol Patil Sep 7, 2015 at 12:59

you have to add the Gson library in the dependency using project structure, now to update the gradle, for the add the .jar file to your build.gradle file like

dependencies {
compile files('libs/gson-2.2.4.jar')

if it dosent works try changing it to

dependencies{
compile 'com.google.code.gson:gson:2.2.+'

make sure you are also connected to the internet so that jars will be downloaded online through maven repo.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.