2016-04-09 89 views
1

我正在爲Unity3d構建一個android庫。這個庫正在Android Studio中開發,我正在使用一些模塊,比如google admob。爲此,我在gradle文件中添加了「com.google.android.gms:play-services-ads:8.4.0」。 的問題是,當我建立Unity3d項目,應用程序崩潰,因爲沒有找到AdMob廣告類:依賴Unity的Android庫3d

這裏是日誌

FATAL EXCEPTION: main 
Process: com.-----, PID: 8280 
java.lang.Error: FATAL EXCEPTION [main] 
Unity version  : 5.3.2f1 
Device model  : htc Nexus 9 
Device fingerprint: google/volantis/flounder:6.0.1/MMB29V/2554798:user/release-keys 
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/ads/AdView; 
..... 
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.ads.AdView" on path: DexPathList 

這是我的圖書館的gradle這個文件:

apply plugin: 'com.android.library' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.2" 

defaultConfig { 
    minSdkVersion 15 
    targetSdkVersion 23 
    versionCode 1 
    versionName "1.0" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
    } 
    } 
} 

dependencies { 
compile fileTree(dir: 'libs', include: ['*.jar'], exclude: ['classes.jar']) 
testCompile 'junit:junit:4.12' 
compile 'com.android.support:appcompat-v7:23.2.1' 
compile 'com.google.android.gms:play-services-ads:8.4.0' 
provided files('libs/classes.jar') 
} 

有沒有辦法創建一個具有依賴性的android庫,把它放在Unity中,而不用把我在這個庫中使用的sdks?我的意思是,我想用我正在使用的所有sdks構建我的庫,並且只將我的庫放在Unity3d中。

謝謝

回答