This is starting to really mess my mind.
I have create a simple project, in Android Studio, that is only the initial Activity that it generates.
To this, I add a module which defines a single Class, Util, ad use its method in my activity.
When I try to build I get the following error:
CoreTest/app/src/main/java/com/foo/core/Example.java:17: error: cannot find symbol
message = Util.findById(this, R.id.hello);
^
symbol:
variable Util
location: class Example
1 error
My settings.properties looks like:
include ':app', ':core'
project(':core').projectDir = new File('core')
the root build.gradle is nothing special
the app/build.gradle is
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.medweb.core"
minSdkVersion 16
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':core')
}
and the core/build.gradle is nothing special either:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.medweb.core"
minSdkVersion 16
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
I’ve gone through the debug logs and I find this line [org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler] Compiler arguments: -source 1.6 -target 1.6 -d /Users/me/android/test/app/build/intermediates/classes/debug -g -encoding UTF-8 -bootclasspath /Applications/Android Studio.app/sdk/platforms/android-20/android.jar -classpath /Users/me/android/test/core/build/outputs/apk/core-release-unsigned.apk /Users/me/android/test/app/src/main/java/com/foo/core/Example.java /Users/me/android/test/app/build/generated/source/r/debug/com/foo/core/R.java /Users/me/android/test/app/build/generated/source/buildConfig/debug/com/foo/core/BuildConfig.java
and so I go to core-release-unsigned.apk and run dedexer on the classes.dex and I find that my Utils class is defined in there, as are its methods.
So what am I doing wrong?