2017-10-26 2 views
0

を許可していない私は、この問題との相対ソリューションを持っているが、それは私だけのAndroid 3.0にアップグレードし、私をコンパイルしようとしたGradleのエラー:JSON標準は、このようなトークン(アンドロイドスタジオ3.0)

に動作しますなぜ私は知りませんアプリ。私は私がこのような構造を持っている場合

android{ 
    .... 
} 
dependencies { 
    .... 
} 

を(私は関連部分をしておこう)gradle.buildでERROの多くを持っているとエラーがJSON標準は、このようなトークン

を許可していないですが、もし私は

エラーがここに表示されます(の依存性がINSIDEアンドロイドオブジェクトである)

android { 
    .... 

    dependencies { 
    .... 
    } 
} 

に構造を変更します。言う別のエラーと

compile '**com.android.support**:support-v4:26.1.0' 
compile '**com.loopj.android**:android-async-http:1.4.9' 
"<値>予想は、得た ':'" 任意のアイデア?

答えて

1

例が変更されました。次のようにしてください。

これを行う最良の方法です。

buildscript { 
    repositories { 
     mavenCentral() 
     jcenter() 
     google() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.3' 
     // NOTE: Do not place your application dependencies here; they belong 
     // in the individual module build.gradle files 
    } 
} 

allprojects { 
    repositories { 
     mavenCentral() 
     jcenter() 
     google() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 

とあなたのgradle-wrapper.propertiesファイル内に必ずある作るアプリレベルのbuild.gradleにも

distributionUrl=https\://services.gradle.org/distributions/gradle-4.2.1-all.zip 

以下のようにラッパーのバージョンを変更するには、以下のルートレベルgradle.buildの使用では

以下のように26ベシオンを使用してください

android { 
    compileSdkVersion 26 
    buildToolsVersion "26.0.2" 
    defaultConfig { 
     applicationId "com.xxxx" 
     minSdkVersion 16 
     targetSdkVersion 26 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
     exclude group: 'com.android.support', module: 'support-annotations' 
    }) 
    debugCompile project(':debug-db') 
    compile project(':tracker') 
    compile 'com.android.support:appcompat-v7:26.1.0' 
    compile 'com.android.support:design:26.1.0' 
    compile 'com.android.support:cardview-v7:26.1.0' 
    compile 'com.android.support:multidex:1.0.2' 
    compile 'com.google.android.gms:play-services-location:11.4.2' 
    compile 'com.google.android.gms:play-services-places:11.4.2' 
    compile 'com.google.android.gms:play-services-maps:11.4.2' 


    compile 'com.google.firebase:firebase-core:11.4.2' 
    compile 'com.google.firebase:firebase-crash:11.4.2' 
    compile 'com.google.firebase:firebase-messaging:11.4.2' 
    compile 'com.mcxiaoke.volley:library:1.0.19' 
    compile 'com.squareup.okhttp3:okhttp:3.4.2' 
    compile 'de.hdodenhof:circleimageview:2.1.0' 
    compile 'com.github.Kunzisoft:Android-SwitchDateTimePicker:1.7' 
    compile 'com.github.safetysystemtechnology:location-tracker-background:v1.2' 
    compile 'com.squareup.retrofit2:retrofit:2.3.0' 
    compile 'com.squareup.retrofit2:converter-gson:2.3.0' 
    compile 'com.android.support.constraint:constraint-layout:1.0.2' 
    compile 'com.android.support:recyclerview-v7:26.1.0' 
    testCompile 'junit:junit:4.12' 
} 
// Add to the bottom of the file 
apply plugin: 'com.google.gms.google-services' 
+0

あなたの答えに感謝!あなたが見ることができるように、あなたの答えでは、 '依存関係' jsonオブジェクトは 'アンドロイド'の外にあります。 –

+0

ええ、外に出なければなりません。 google()reposを追加しました –

+0

はい私はしました。問題は、もし私が外にいると "画面上に"エラーが出るが、それは問題なくコンパイルされるということだ。それは奇妙です –

関連する問題