1

I am trying to implement the libraries from the company Appodeal (an Ad mediation company) to my App in Android Studio, so I can run their advertisements and monetize my App. I followed their instructions: First, put the necessary libraries in the libs folder Second, add the necessary dependencies in the gradle file:

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
    applicationId 'com.languagematerial.lmmovies'
    minSdkVersion 23
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    multiDexEnabled true
    useLibrary 'org.apache.http.legacy'
    vectorDrawables.useSupportLibrary = true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
productFlavors {
}

packagingOptions {

    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
}

}

repositories{
jcenter()
flatDir {
    dirs 'libs'
}

}

dependencies {
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:27.0.0'
compile 'com.android.support:recyclerview-v7:27.0.0'
compile 'com.android.support:support-media-compat:27.0.0'
compile 'com.android.support:support-v4:27.0.0'
android {
    configurations.all {
        resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
    }
}
compile 'com.android.support:multidex:1.0.3'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'org.apmem.tools:layouts:1.10@aar'
compile 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.14'
compile 'com.nononsenseapps:filepicker:4.1.0'
compile 'org.apache.commons:commons-io:1.3.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:gridlayout-v7:27.0.0'
compile files('libs/icu4j-61_1.jar')
compile 'android.arch.lifecycle:extensions:1.0.0-alpha4'
compile 'android.arch.persistence.room:runtime:1.0.0-alpha4'
annotationProcessor "android.arch.lifecycle:compiler:1.0.0-alpha4"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0-alpha4"

compile 'pub.devrel:easypermissions:0.3.0'
compile('com.google.api-client:google-api-client-android:1.23.0') {
    exclude group: 'org.apache.httpcomponents'
}
compile('com.google.apis:google-api-services-youtube:v3-rev186-1.23.0') {
    exclude group: 'org.apache.httpcomponents'
}
compile 'com.google.android.gms:play-services-auth:10.2.1'

compile 'com.google.android.ads.consent:consent-library:1.0.3'

compile 'com.google.android.gms:play-services-base:10.2.1'

compile 'com.google.android.gms:play-services-ads:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
//for Inmobi
compile name: 'adcolony-sdk-3.2.1', ext: 'aar'
compile name: 'mmedia-6.4.0', ext: 'aar'
compile name: 'mobvista_alphab', ext: 'aar'
compile name: 'mobvista_appwall', ext: 'aar'
compile name: 'mobvista_appwallext', ext: 'aar'
compile name: 'mobvista_common', ext: 'aar'
compile name: 'mobvista_interstitial', ext: 'aar'
compile name: 'mobvista_mvdownloads', ext: 'aar'
compile name: 'mobvista_mvjscommon', ext: 'aar'
compile name: 'mobvista_mvnative', ext: 'aar'
compile name: 'mobvista_nativeex', ext: 'aar'
compile name: 'mobvista_offerwall', ext: 'aar'
compile name: 'mobvista_playercommon', ext: 'aar'
compile name: 'mobvista_reward', ext: 'aar'
compile name: 'mobvista_videocommon', ext: 'aar'
compile name: 'mobvista_videofeeds', ext: 'aar'

}

This syncs successfully. The problem arises when I add the packages to my Manifest file. As the picture shows, the majority of them are in red with the message: Unresolved class, as if the referred libraries were not in the lib folder, but apparently they are there. So where is this problem coming from? Not even the Tech Support guys at Appodeal could help me. Do you have any clue?

enter image description here

Carlos Botero
  • 319
  • 3
  • 11
  • Solved! Just add inside dependencies: compile fileTree(dir: 'libs', include: ['*.jar']) . In other gradles I have seen implementation instead of compile. Now only tools:replace will show an error in Manifest. Just add this line at the heading where the other xmlns are: xmlns:tools="http://schemas.android.com/tools" and done! Saludos – Carlos Botero Jul 18 '18 at 04:06
  • Hello, Where to add this "compile fileTree(dir: 'libs', include: ['*.jar'])", in which file? can please write steps as answer? – PhpCoder Jul 05 '19 at 17:14

0 Answers0