tolgap tolgap - 11 months ago 40
Android Question

Android Studio can't find library classes after Gradle build

I'm trying to add a

library to my project into the
folder. Here is my

buildscript {
repositories {
dependencies {
classpath ''
apply plugin: 'android'

dependencies {
compile files('libs/android-support-v4.jar', 'libs/java-api-wrapper-1.2.0-all.jar')

android {
compileSdkVersion 17
buildToolsVersion "17.0.0"

defaultConfig {
minSdkVersion 15
targetSdkVersion 16

After I add that, I build my project and there are no errors. But when I try to use the class in my code
private ApiWrapper wrapper
, I get an error:

Gradle: error: cannot find symbol class ApiWrapper

I can't quite find where the error is. Is my
not ok, or am I supposed to build it some other way?

Answer Source

Using the command line, in the root of your project, run :
./gradlew clean && ./gradlew build

Then recompile your project in studio and you should see your new lib.