GhostNinja
GhostNinja

Reputation: 23

Neither path nor baseDir may be null or empty string

I imported a open source project and when it syncs the project I run into the following issue and can't figure out how to fix the issue.

Error:(99, 0) Neither path nor baseDir may be null or empty string. path='null' basedir='/Users/Technologx/Desktop/Android Projects/New/sysexplorer'

Here's my build.gradle code:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.1'

    defaultConfig {
        versionName "1.0"
        versionCode = 10
        minSdkVersion 17
        targetSdkVersion 25
        vectorDrawables.useSupportLibrary = true
    }
    signingConfigs {
        release
    }
    buildTypes {
        debug {
            minifyEnabled false
            shrinkResources true
            useProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard/proguard-project.pro',
                    'proguard/proguard-google-play-services.pro'
        }
        release {
            signingConfig signingConfigs.release
            minifyEnabled true
            shrinkResources true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'),
                    getDefaultProguardFile('proguard-android-optimize.txt'),
                    'proguard/proguard-project.pro',
                    'proguard/proguard-google-play-services.pro'
        }
    }
    flavorDimensions "release", "default"
    productFlavors {
        free {
            applicationId "com.technologx.sysexplorer.free"
            dimension "default"
        }
        pro {
            applicationId "com.technologx.sysexplorer.pro"
            dimension "default"
        }
        underground {
            applicationId "com.technologx.sysexplorer.underground"
            dimension "default"
        }
        google {
            dimension "release"
        }
        amazon {
            dimension "release"
        }
        other {
            dimension "release"
        }
    }
    variantFilter { variant ->
        def names = variant.flavors*.name

        if (names.contains("underground") && (names.contains("google") || names.contains("other"))) {
            variant.ignore = true
        }
    }
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
    }
    lintOptions {
        abortOnError false
    }
    aaptOptions {
        noCompress 'apk'
    }
}

ext {
    supportLibVersion = '25.1.0'
    gmsVersion = '10.0.1'
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.jaredrummler:android-processes:+'
    compile 'com.github.mjdev:libaums:+'
    compile 'org.apache.ftpserver:ftpserver-core:+'
    compile 'commons-net:commons-net:+'
    compile "com.android.support:appcompat-v7:${supportLibVersion}"
    compile "com.android.support:design:${supportLibVersion}"
    compile "com.android.support:exifinterface:${supportLibVersion}"
    freeCompile "com.google.firebase:firebase-crash:${gmsVersion}"
    freeCompile "com.google.firebase:firebase-ads:${gmsVersion}"
}

def props = new Properties()
props.load(new FileInputStream(rootProject.file("keystore.properties")))
android.signingConfigs.release.storeFile rootProject.file(props.keyStore)
android.signingConfigs.release.storePassword props.keyStorePassword
android.signingConfigs.release.keyAlias props.keyAlias
android.signingConfigs.release.keyPassword props.keyAliasPassword

if (getGradle().getStartParameter().getTaskRequests().toString().contains("Free")) {
    apply plugin: 'com.google.gms.google-services'
}

Upvotes: 0

Views: 1432

Answers (1)

pratt
pratt

Reputation: 1813

I guess the problem is in this line:

android.signingConfigs.release.storeFile rootProject.file(props.keyStore)

Gradle tells you that possible null or empty string is passed to file() method (props.keyStore variable). You need to explicitly define and initialize it in your build.gradle. Or you need to have keystore.properties file (in the project root dir) with the content like this:

keyStore=your_keystore_file
keyStorePassword=your_store_pass
keyAlias=your_alias
keyAliasPassword=your_alias_pass

Upvotes: 1

Related Questions