【发布时间】:2014-12-24 10:02:41
【问题描述】:
我在 build.gradle(mopub-sdk) 文件中添加了这个
buildTypes {
release {
runProguard true;
proguardFiles getDefaultProguardFile('proguard-android.txt'), file('proguard.txt')
}
}
我的 proguard.txt 文件是
# Keep public classes and methods.
-keepclassmembers class com.mopub.** { public *; }
-keep public class com.mopub.**
-keep class com.mopub.mobileads.**{*;}
-keep public class com.mopub.mobileads.MoPubInterstitial
-keep public class com.mopub.mobileads.MoPubView
-keep public class android.webkit.JavascriptInterface {}
# Keep interfaces
-keep interface com.mopub.mobileads.MoPubInterstitial.InterstitialAdListener
-keep interface com.mopub.mobileads.MoPubView.BannerAdListener
# Explicitly keep any custom event classes in any package.
-keep class * extends com.mopub.mobileads.CustomEventBanner {}
-keep class * extends com.mopub.mobileads.CustomEventInterstitial {}
-keep class * extends com.mopub.nativeads.CustomEventNative {}
# Support for Android Advertiser ID.
-keep class com.google.android.gms.common.GooglePlayServicesUtil {*;}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {*;}
-keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {*;}
但是在构建时,我得到了这个错误:
Error:(33, 45) error: cannot find symbol class InterstitialAdListener
Error:(35, 37) error: cannot find symbol class BannerAdListener
还有其他一些,但大多数都与上述两个有关。这里有什么问题?
【问题讨论】:
-
我的 gradle 插件版本是 0.13
-
请查看我更新的答案。如果不工作,让我通知。
-
嗨,好的..我会尝试并发布回复。
-
嗨,我收到以下错误:Gradle build 在 1 sec 内完成了 1 个错误 6:20:40 PM UnsupportedMethodException 无法在项目“xxxxx”中设置 Android 模块:不支持的方法: SourceProvider.getJniDirectories()。您连接的 Gradle 版本不支持该方法。要解决此问题,您可以更改/升级您连接到的 Gradle 目标版本。或者,您可以忽略此异常并从模型中读取其他信息。
-
更新类路径 'com.android.tools.build:gradle:0.13.+' this .你的逻辑是正确的。 .14+ 不支持
标签: android android-studio proguard mopub