1

I have created a backend module that contains the endpoints classes. It also has libraries that contain the endpointapi classes. During compile time, I am able to import both, the classes of that module and its library in the MainActivity file of the app. During run time however, it fails to detect the classes present in the library of the module. What could be the issue?

The error while running code is as follows:

Error:(10, 66) error: package com.example.shashank_pc.myapplication.backend.tempClassApi does not exist

The folder structure for backend module inside project is as follows:

enter image description here

For some reason, the classes inside the backend libraries, such as the those present in the tempClassApi and myApi folder, are not being detected

settings gradle file:

include ':app', ':backend'

App module gradle build file:

apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "26.0.1"
defaultConfig {
    applicationId "com.example.shashank_pc.testcloudendpoints"
    minSdkVersion 22
    targetSdkVersion 25
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

packagingOptions {
    exclude 'com/google/appengine/repackaged/org/apache/commons/codec/language/bm/*'
    exclude 'com/google/appengine/repackaged/org/codehaus/jackson/impl/*'
    exclude 'com/google/appengine/repackaged/org/apache/commons/codec/language/*'
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.code.findbugs:jsr305:2.0.1'
testCompile 'junit:junit:4.12'
compile project(':backend')
}
Thanatos
  • 282
  • 5
  • 18

0 Answers0