I am trying to compile an APK that consumes a legacy lib in a JAR file.
I have already gone through other questions on SO and none helped me: 1, 2, 3 and 4. I've even found an open issue on github related to my suffering gradle/gradle/issues/1184 -- gradle -q dependencies does not list local file dependencies... which sucks, because I lost a lot of time thinking the file dependency was not being included.
Anyways, this is my project's build.gradle file:
// Project's build.gradle
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.1'
    }
}
allprojects {
    repositories {
        google()
        jcenter()
    }
}
And this is the app's build.gradle
// app's build.gradle
apply plugin: 'com.android.application'
android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.mycompany.myapp"
        minSdkVersion 24
        targetSdkVersion 26
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation files('libs/mylib_java.jar')
}
The problem is that when I run a ./gradlew build I get an error as if the package implemented in mylib_java.jar did not exist...
Task :app:compileDebugJavaWithJavac FAILED /home/donatoaz/my_apk_gradle/app/src/main/java/com/mycompany/myapp/MainActivity.java:18: error: package mycompany.mylib.audiofx does not exist import mycompany.mylib.audiofx.CustomEffect;
Now, I used to be able to compile the apk fine, but that was using a very old Android Studio, no gradle (I was using API Level 19, Android 4.4).
I am using gradle 4.5.1 now. PS I am not using Android Studio, this is building in a continuous integration server, headless.
The link to the build scan created by gradle is here
 
    