2015-06-05 22 views
0

我有一個庫項目,碰撞xml名稱,如activity_login等.. 現在,即使這是我在庫項目中運行Actvity的情況是膨脹我的xml而不是它自己和隨後投擲NPE。錯誤的xml正在充氣android

我已經試過給它的完全合格的R文件名,但它似乎仍然是在膨脹錯誤的文件。

ps:我試過乾淨的版本不能在AS1.2.1.1上工作。 這是一個AS的錯誤還是我做錯了什麼

這裏是我的gradle這個文件

buildscript { 
    repositories { 
     maven { url 'http://download.crashlytics.com/maven' } 
    } 

    dependencies { 
     classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+' 
    } 
} 
apply plugin: 'com.android.application' 
apply plugin: 'crashlytics' 

repositories { 
    maven { url 'http://download.crashlytics.com/maven' } 
} 


android { 
    compileSdkVersion 21 
    buildToolsVersion "21.1.2" 

    defaultConfig { 
     applicationId "com.xxx" 
     minSdkVersion 14 
     targetSdkVersion 21 
     versionCode 17 
     versionName "2.4.3" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro' 
     } 
    } 
} 

    dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile 'com.android.support:appcompat-v7:21.0.+' 
    compile 'com.google.android.gms:play-services:6.5.+' 
    compile 'com.android.support:support-v4:21.0.+' 
    compile 'com.android.support:recyclerview-v7:22.0.+' 
    compile 'com.android.support:cardview-v7:21.0.+' 
    compile project('libraries:holograph') 
    compile project('libraries:facebook') 
    compile files('libs/google-api-client-android-1.18.0-rc.jar') 
    compile files('libs/google-api-client-java6-1.18.0-rc.jar') 
    compile files('libs/google-api-client-1.18.0-rc.jar') 
    compile 'com.crashlytics.android:crashlytics:1.+' 
    compile project(':chartlib') 
    compile project(':payu') 
} 

而且payu的是的build.gradle

apply plugin: 'com.android.library' 

android { 
    compileSdkVersion 21 
    buildToolsVersion "21.1.2" 

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

dependencies { 
    compile('de.keyboardsurfer.android.widget:crouton:[email protected]') { 
     exclude module: 'support-v7' 
     compile 'com.android.support:appcompat-v7:18.0.+' 
    } 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    compile 'de.greenrobot:eventbus:2.2.1' 
    compile 'com.loopj.android:android-async-http:1.4.6' 
    compile 'com.mobsandgeeks:android-saripaar:1.0.3' 
    compile project(':CustomBrowser') 
} 

而且我Settings.gradle

include ':app', ':payUMoneysdk', ':CustomBrowser' 

回答

0

這是happ通過設計引入,將其視爲重寫圖書館活動佈局。我用它廣泛用於字符串,顏色等,它更有用。

只需重命名您的項目XML佈局。

+0

反正沒有防止覆蓋,因爲碰撞可能發生在很多組件中,而不僅僅是佈局。 – humblerookie

+0

爲了避免它出現在庫中的資源前綴是個好習慣,比如pm_activity_login,假設Pay Money lib導致了問題,但依賴於lib創建者這樣做。 – CodeChimp