Long story short I have decided to play around with the new Google wearable stuff, so I opened up android studio and clicked the import from sample project. (mind you it does not matter what project I chose to import and have tried many of them)
I open the project and Everything is wrong because Android studio can't find the wearable imports... BUT it CAN build it to the watch just fine. So basically if I type
mApiClient = new GoogleApiClient.Builder(this);
The GoogleApiClient is made red because it "Cannot find the object"
import com.google.android.gms.common.ConnectionResult; <-- cannot find symbol common
import com.google.android.gms.common.api.GoogleApiClient; <-- cannot find symbol common
import com.google.android.gms.common.api.ResultCallback; <-- cannot find symbol common
import com.google.android.gms.wearable.MessageApi; <-- cannot find symbol MessageApi
import com.google.android.gms.wearable.MessageEvent; <-- cannot find MessageEvent
import com.google.android.gms.wearable.Node; <-- Cannot find Node
import com.google.android.gms.wearable.NodeApi; <-- Cannot find NodeApi
import com.google.android.gms.wearable.Wearable; <-- Cannot find Wearable
Now mind you... All of this builds... It just renders the editor useless due to the fact that it gives me no code assistance and is always telling me there are 100s of errors in the project. It is worse then notepad!
Things I have tried:
Uninstalling and reinstalling Android Studio (3 times now)
Uninstalling and reinstalling ALL of the android SDK's and extra tools
Clicking the button to Sync Project with Gradle (1000s of times)
Checking all Gradle files for the right packages (again, these are the sample code and it does build... so it has to be getting the right stuff...)
Threatening my PC with installing Hackintosh on it and then burning it. (at least 6 times now)
I have tried looking around but so far have not found anything that fixed it. any help would be much appreciated.
Thanks
EDIT:
(Delayed Application wearable sample code!)
gradle files:
Module Application:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'com.android.application'
repositories {
jcenter()
}
dependencies {
compile "com.android.support:support-v4:21.0.2"
compile "com.android.support:support-v13:21.0.2"
compile "com.android.support:cardview-v7:21.0.2"
compile 'com.google.android.gms:play-services-wearable:6.5.+'
compile 'com.android.support:support-v13:21.0.+'
wearApp project(':Wearable')
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 18
targetSdkVersion 21
}
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot('tests')
androidTest.java.srcDirs = ['tests/src']
}
}
Module: Wearable
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
apply plugin: 'com.android.application'
dependencies {
compile 'com.google.android.gms:play-services-wearable:6.5.+'
compile 'com.android.support:support-v13:21.0.+'
compile 'com.google.android.support:wearable:1.1.+'
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
androidTest.setRoot('tests')
androidTest.java.srcDirs = ['tests/src']
}
}
Hope this helps! hopefully I'm missing something stupid. On my mac I was able to import the sample code and run it (on my windows I can run it... just editing is going to be terrible.)