2015-11-15 7 views
15

私の最初のアンドロイドウェアアプリを作っていますが、アンドロイドスタジオは動作しません。 まず、私はこれはsettings.gradle"include ':wear"を追加することで解決しましたGradle error:設定が宣言されていない依存関係を宣言しました

"Project with path ':wear' could not be found in project ':mobile'. 

エラーが発生しました。
しかし、その後、新たなエラーが発生します。

"Error:Module version Test2:mobile:unspecified, configuration 'wearApp' declares a dependency on configuration 'default' which is not declared in the module descriptor for Test2:wear:unspecified" . 

私はそのエラーを解決するために行う必要がありますか?

ただ、それが必要だ場合:ここbuild.gradleだ:

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

    defaultConfig { 
     applicationId "com.verbraeken.joost.test2" 
     minSdkVersion 19 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    wearApp project(':wear') 
    testCompile 'junit:junit:4.12' 
    compile 'com.android.support:appcompat-v7:23.1.1' 
    compile 'com.google.android.gms:play-services:8.3.0' 
    compile 'com.android.support:design:23.1.1' 
} 

settings.gradle:

include ':mobile' 
include ':wear' 
+0

はこちら摩耗のあなたのbuild.gradleを貼り付けてください。 – starkshang

+0

Androidスタジオは着用のためのbuild.gradleを作っていませんでした。これはsettings.gradle、トップレベルのbuild.gradleとmobile build.gradleのみを作成しました –

+0

こんにちは、私はこのような問題を取得しています。 "エラー:プロジェクトの設定中に問題が発生しました:"アプリケーション: >設定: 'app:_debugApk'。 >すべての依存関係を解決できませんでした:プロジェクト:appは、 'compile'設定から 'default' project:linkedin-sdkの記述子で宣言されています。 – Naveen

答えて

37

は言う:

dependencies { 
    // This is the old method and no longer works for local 
    // library modules: 
    // debugCompile project(path: ':foo', configuration: 'debug') 
    // releaseCompile project(path: ':foo', configuration: 'release') 

    // Instead, simply use the following to take advantage of 
    // variant-aware dependency resolution. You can learn more about 
    // the 'implementation' configuration in the section about 
    // new dependency configurations. 
    implementation project(':foo') 

    // You can, however, keep using variant-specific configurations when 
    // targeting external dependencies. The following line adds 'app-magic' 
    // as a dependency to only the 'debug' version of your module. 

    debugImplementation 'com.example.android:app-magic:12.3' 
} 

だから、この

にこの

debugCompile project(path: ':foo', configuration: 'debug') 
    releaseCompile project(path: ':foo', configuration: 'release') 

を変更3210

+3

エラーが発生しました。エラー:(151、1)プロジェクト ':app'の評価中に問題が発生しました。 > org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler型のオブジェクトの引数[project ':xyz']のメソッドimplementation()を見つけることができませんでした。 – Manish

+0

@Manish implementation()メソッドを使用するにはAndroid Studio 3.0.0以上が必要です。まだAS 2.3.3/Productionでは利用できません。 – Aceofspadez44

+0

私はアンドロイド3、同じ問題です。エラー:(225、0)型org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandlerのオブジェクトの引数[project ':commons']のメソッド実装()が見つかりませんでした。 – StarWind0

6

Error:Module version Test2:mobile:unspecified, configuration 'wearApp' declares a dependency on configuration 'default'

それはモジュール(あなたのケースでwearApp)が持っていないことを意味build.gradleファイルまたはbuild.gradleファイル内の正しい構成である必要があります。

settings.gradleでモジュールを定義したので、モジュールごとにbuild.gradleを指定する必要があります。あなたのケースでは

Migrate to the New PluginのためのAndroidメーカー3.0ドキュメントで

root 
|-- mobile 
|----build.gradle 
|-- wear 
|----build.gradle 
|--build.gradle 
|--settings.gradle 
+0

モジュールがjavaファイルを持っている外部ライブラリの場合はどうすればいいでしょうか?同じ手順を踏んでも同じエラーが表示されます。 エラー:Project:appは、 'compile'の設定から ':default'というプロジェクトの記述子で宣言されていない設定 'default'への依存関係を宣言します。私は https://github.com/amaurycrickx/recognitoを含めるライブラリへ リンク 私は私の場合にはbuild.gradle – UrviG

+0

をsettings.gradleアプリに変更を加えた、私は、Gitのサブモジュールにアクセスする資格の問題がありましたしたがって、モジュールの内容は空でした。ありがとう! – Maragues

2

あなたは、Android Studioの3.0を使用していない場合、これはあなたのbuild.gradleのlibに、私の仕事:この

android { 
    compileSdkVersion maxApiLevel.toInteger() 
    buildToolsVersion androidBuildToolsVersion 
    publishNonDefault true 

    [...] 
} 

そして、あなたのように

publishNonDefault真

をbuild.gradleを含める:

dependencies { 
    debugCompile project(path: ':foo', configuration: 'debug') 
    releaseCompile project(path: ':foo', configuration: 'release') 
} 
0

私はイオンコード私の場合、ファイルbuild.gradeは毎回更新されました。ファイル "app_path> node_modules \ cordova-android \ bin \ templates \ cordova \ lib \ builders \ GradleBuilder.js"を次の場所から変更する必要があります。

console.log('Subproject Path: ' + p); 
    var libName=p.replace(/[/\\]/g, ':').replace(name+'-',''); 
    depsList += ' debugCompile(project(path: "' + libName + '", configuration: "debug"))'; 
    insertExclude(p); 
    depsList += ' releaseCompile(project(path: "' + libName + '", configuration: "release"))'; 
    insertExclude(p); 

へ:

console.log('Subproject Path: ' + p); 
    var libName=p.replace(/[/\\]/g, ':').replace(name+'-',''); 
    depsList += ' compile project(\'' + libName + '\')'; 
    insertExclude(p); 

作品私

関連する問題