Intro
I have an app and I currently started working om some backend code. To prevent code duplication, I want to move some of my code into a library.
This is what I did:
build.gradle
I put implementation
files('libs/numbers-lib.jar')
)Problem
Now when I try to use one of the classes I get Cannot resolve symbol 'Level'
(see also screenshot). What am I missing?
EDIT: I already cleaned/rebuilt my project and invalidated caches.
EDIT2: Here is my gradle (upon request)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.my.example"
minSdkVersion 21
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
targetSdkVersion 27
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'junit:junit:4.12'
implementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation 'postgresql:postgresql:9.0-801.jdbc4'
implementation files('libs/numbers-lib.jar')
}
EDIT3: Here is a screenshot. You can see that the library has the correct Class...
It turned out I had to put my library classes into a package before creating the library.