I'm making my first android wear app, but I can't get Android Studio working. First I got the error
"Project with path ':wear' could not be found in project ':mobile'.
This was resolved by adding "include ':wear"
in settings.gradle
.
But then a new error occurs:
"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" .
What do I have to do to resolve that error?
Just in case it's needed: here's 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'
It means that a module (wearApp in your case) doesn't have a
build.gradle
file or a right configuration inside thebuild.gradle
file.Since you define a module in
settings.gradle
you have to provide abuild.gradle
for each module.In your case:
The trick is:
You don't have t set flavor or type build now, gradle 3.0 and above search for each flavor and buildType. More info: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration#variant_dependencies
In Android Studio 3.0 the documentation for Migrate to the New Plugin says:
So change this
to this
If you're not using Android Studio 3.0, this worked for me, in your build.gradle lib:
publishNonDefault true
like this
And in your include build.gradle:
I am using ionic cordova for build my app, in my case the file build.grade was updated each time, I have to change the file "app_path>node_modules\cordova-android\bin\templates\cordova\lib\builders\GradleBuilder.js" from:
to:
Works for me