My buiild.gradle is failing. I get the Error: `Cau...
# android
g
My buiild.gradle is failing. I get the Error:
Cause: only whitespace content allowed before start tag and not \u0 (position: START_DOCUMENT seen \u0... @1:1)
while using `apply plugin: "androidx.navigation.safeargs"`` i
a
Full gradle file, or preferably the change that makes the problem happen? This may also not be kotlin related
g
Copy code
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
apply plugin: "androidx.navigation.safeargs"

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"


    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles '<http://consumer-rules.pro|consumer-rules.pro>'
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), '<http://proguard-rules.pro|proguard-rules.pro>'
        }
    }

    dataBinding {
        enabled = true
    }

    kotlinOptions {
        jvmTarget = "1.8"
        freeCompilerArgs = ["-XXLanguage:+InlineClasses"]
    }

}

dependencies {
    implementation project(':fhircore')
    implementation project(':fhirmedmij')
    implementation project(':fhirterminology')

    implementation project(':zorgkluisui')
    implementation project(':medmijkwalificatie')
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'

    // Navigation Components
    implementation "android.arch.navigation:navigation-ui-ktx:1.0.0"
    implementation "android.arch.navigation:navigation-fragment-ktx:1.0.0"

    // Lifecycle Components
    implementation  "androidx.lifecycle:lifecycle-extensions:2.2.0"
    implementation  "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
    implementation  "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
I also added
Copy code
def nav_version = "2.3.0-alpha01"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
to classpath dependencies
And
Copy code
apply plugin: "androidx.navigation.safeargs.kotlin"
did make no difference since I’m using a 100% kotlin project
a
Did you have no error before? Is there a delta between that and what you have now
g
I moved the code from an application to an library.
You can either try cleaning your cache, or find the file that isn’t formatted properly
g
Yeah I already invalidated caches and restarted the project
The problem seems to be in xmlPullParser. Cannot remind me that I’ll use it.
Already deleted the m2 maven folder, but doesn’t seem to help. It only contained another dependency
Unfortunately it doesnt solve the problem @zhuinden
w
Don’t you have any additional whitespace at the beginning of the file with navigation graphs (xml)?
a
it might be one of your resource files, and not a generated one. As mentioned, ' is fine for gradle files
g
@Lucas Ł im trying to find them, but not in the navigation or layout folder
w
The crash occurs in
parseNavigationFile
so it does seems like one of the files with nav graph is the culprit
g
Well the problem seems to be MacOS related. https://stackoverflow.com/a/60035821/4713369
👍 1
There was a hidden .DS_Store file in the navigation folder…
👌 1
w
Definitely worth reporting. They probably shouldn’t even try to parse non-xml files
👍 3