android Canary 3.0 beta 5 unknown element <library> found

1.9k views Asked by At

I'm trying to add mopub. But when I do, the build manifest adds a library tag and then says it doesn't know what it is. If I remove the link, all works fine.

compile('com.mopub:mopub-sdk:4.16.0@aar') {
    transitive = true
}

<library android:name="moat-mobile-app-kit" />

Error:(34) unknown element found

Error:E:\Web\Studio\Opus\app\build\intermediates\manifests\full\live\debug\AndroidManifest.xml:34 unknown element found

Error:java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.AaptException: AAPT2 link failed:

Error:com.android.builder.internal.aapt.AaptException: AAPT2 link failed: Error:Execution failed for task ':app:processLiveDebugResources'. Failed to execute aapt

6

There are 6 answers

2
natedogg265 On

I got a response from Mopub.

Android Studio 3 uses Gradle 4, and Gradle 4 deprecates the use of the "compile" statement. Therefore you will need to use keywords such as "api" or "implementation" in place of "compile". Please also reference this StackFlow link for additional information.

link here

0
Mate Herber On

There is a moat update that seemingly solves the problem. For me this compiles properly:

implementation 'com.mopub:mopub-sdk:4.19.0@aar'
implementation 'com.moat.analytics.mobile.mpub:moat-mobile-app-kit:2.4.1'
0
chen On

keep repositories and dependencies at a file(build.gradle) ,not two file, like repositories at root build file ,dependencies at module build file

 repositories {
   // ... other project repositories
    jcenter() // includes the MoPub SDK and AVID library
    maven { url "https://s3.amazonaws.com/moat-sdk-builds" }
 }

 // ...

dependencies {
 // ... other project dependencies
 compile('com.mopub:mopub-sdk:4.16.0@aar') {
     transitive = true
  }
}
6
Distjoy On

I experience this issue, after several inspections i can only conclude that manifest merger, includes the line

<library android:name="moat-mobile-app-kit" />

from mopub avid and moat kit,as this is not supported in the new android gradle plugin, your best bet for now will be to disable viewability measurement by editing mopub dependency line as defined below

compile('com.mopub:mopub-sdk:4.17.0@aar') {
    transitive = true
    exclude module: 'libAvid-mopub' // To exclude AVID
    exclude module: 'moat-mobile-app-kit' // To exclude Moat
}
1
casolorz On

The only solution I have found so far is to use MoPub 4.15.

Edit: MoPub has confirmed the issue and they wouldn't give me an ETA on a fix.

Edit: 4.18 still broken.

Edit: I should mention I am using 4.19 now with Moat still disabled and using the code to remove Moat, but I also have to do that on other ad networks that include Moat as well. So if you are having this issue you might want to look at all your ad network compile lines.

Edit: According to MoPub, this is fixed on 4.20.0 and it seems to work for me.

0
Ravi On

Add this to your gradle dependencies.

exclude module: 'moat-mobile-app-kit' if you are using Mopub SDK <= 4.18.0.

It worked for me.

If you are using 4.20.0, they fixed this issue. https://developers.mopub.com/docs/android/changelog/#version-4200-february-20-2018