https://kotlinlang.org logo
#android
Title
# android
g

Geert

02/18/2020, 8:22 AM
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

Allan Wang

02/18/2020, 8:23 AM
Full gradle file, or preferably the change that makes the problem happen? This may also not be kotlin related
g

Geert

02/18/2020, 8:23 AM
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

Allan Wang

02/18/2020, 8:25 AM
Did you have no error before? Is there a delta between that and what you have now
g

Geert

02/18/2020, 8:25 AM
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

Geert

02/18/2020, 8:27 AM
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

wasyl

02/18/2020, 8:48 AM
Don’t you have any additional whitespace at the beginning of the file with navigation graphs (xml)?
a

Allan Wang

02/18/2020, 8:49 AM
it might be one of your resource files, and not a generated one. As mentioned, ' is fine for gradle files
g

Geert

02/18/2020, 8:50 AM
@Lucas Ł im trying to find them, but not in the navigation or layout folder
w

wasyl

02/18/2020, 8:52 AM
The crash occurs in
parseNavigationFile
so it does seems like one of the files with nav graph is the culprit
g

Geert

02/18/2020, 9:23 AM
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

wasyl

02/18/2020, 9:28 AM
Definitely worth reporting. They probably shouldn’t even try to parse non-xml files
👍 3
25 Views