Wrong xml being inflated android

75 views Asked by At

I have a library project which had colliding xml names like activity_login,etc.. Now even though this is the case when I run the Actvity in the library project is inflating my xml instead of its own and subsequently throwing NPE.

I've already tried giving it the fully qualified R file name but it still seems to be inflating the wrong file.

Ps:I've tried clean build doesnt work either on AS1.2.1.1. Is this a bug of AS or am I doing something wrong

Here is my gradle file

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')
}

And build.gradle of payu is

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:1.8.+@aar') {
        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')
}

And my Settings.gradle

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

There are 1 answers

2
CodeChimp On

This is happening by design, consider it as overriding the library activity layout. I use it extensively for Strings, Colors etc. where it's more useful.

Just rename your projects XML layouts.