2017-10-13 3 views
2

私はバーコードスキャナのアプリを開発しています。Android Build.gradleでコンパイルするために実装を置き換える方法。 (Android Studio 2.3.3)

URL:しかし、私は、このライブラリはの置き換えに実装を使用することを提案した:Barcode Scanner URL Here

私のAndroid Studioのバージョンが2.3.3

私はいつもbuild.gradleでコンパイル(アプリモジュール)を使用していますをコンパイルします。私は、インターネットコンパイル上で検索

は、Android 3.0のスタジオで実装に置き換えられますが、私は、Android 2.3.3スタジオでこのライブラリを使用する必要があります。

例。

dependencies { 
implementation 'com.budiyev.android:code-scanner:1.5.7' 
} 

私は私のGradleその示すエラーでこれを置くとき。

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar']) 
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 
    exclude group: 'com.android.support', module: 'support-annotations' 
}) 
compile 'com.android.support:appcompat-v7:26.+' 
compile 'com.android.support.constraint:constraint-layout:1.0.2' 
compile 'com.budiyev.android:code-scanner:1.5.7' // HERE 
testCompile 'junit:junit:4.12' 
} 

エラーは次のとおりです。

Error:Failed to resolve: com.android.support:support-annotations:26.1.0 
    Install Repository and sync project 
    Show in Project Structure dialog 

は2.3.3

答えて

3

はあなたがGoogleのMavenのリポジトリを追加する必要があり、私は私のアンドロイドスタジオでこのライブラリを使用する方法を教えてくださいトップレベルbuild.gradle

 allprojects { 
     repositories { 
     google() 

     // If you're using a version of Gradle lower than 4.1, you must instead use: 
     // maven { 
     //  url 'https://maven.google.com' 
     // } 
     // An alternative URL is 'https://dl.google.com/dl/android/maven2/' 
    } 
} 
+0

言って申し訳ありませんが、何も同じエラーメッセージが起こりません。私はbuild.gradle compile 'com.budiyev.android:code-scanner:1.5.7'をコンパイルするために実装を置き換えました。 –

+1

@Abhishekkumar https://github.com/yuriy-budiyev/code-scannerによると、あなたは 'implementation 'com.budiyev.android:code-scanner:1.5.7''を使うべきです。 –

+1

@IntelliJAmiya right –

1

はこのように、プロジェクトレベルのGradleにMavenのレポを追加します。

allprojects { 
    repositories { 

     maven { 
      url "https://maven.google.com" 
     } 
    } 
} 

これは、Android Studioバージョン2.3.3やGradleのバージョンのためであるより低い4.1

+0

私は追加しましたが、同じエラーメッセージが表示されます。 –

+0

あなたのbuildToolsVersionとは何ですか? –

+0

classpath 'com.android.tools.build:gradle:2.3.3' –

関連する問題