I am developing an android application that requires a Java library application (which I also wrote) to run.
I followed idunnololz guide here to add the project as a java library which seemed to add ok. My java project is called Osmosis and contains 2 packages search and common.
I then tried to reference my project, with Android Studio very helpfully asking if I wish to reference osmosis. This seemed to resolve the error, with import Search.* being added to the top of my android class. However, when I run my application I get the error: package does not exist. Until I click run it shows no errors.
Can anyone give any advice on how to fix this?
I have tried invalidating the caches, cleaning and rebuilding the project
My settings.gradle seems to include the reference:
include ':app', ':osmosis'
and here is my build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.matt.windowrunner"
minSdkVersion 21
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:6.5.87'
}
The errors:
Error:(48, 14) error: package search does not exist
Error:(448, 7) error: cannot find symbol variable Search
Error:(460, 7) error: cannot find symbol variable Search
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Error:Execution failed for task ':app:compileDebugJava'.
> Compilation failed; see the compiler error output for details.