相关疑难解决方法(0)

Android库中的Firebase依赖关系:无法在null对象上调用方法get()

在向android库添加firebase依赖项时,我遇到了构建问题.

我的设置如下

/settings.gradle

include ':module-lib'
include ':module-app'
Run Code Online (Sandbox Code Playgroud)

/build.gradle

buildscript {
  dependencies {
    classpath 'com.android.tools.build:gradle:3.1.2'
    classpath 'com.google.gms:google-services:4.0.0'
  } 
}
Run Code Online (Sandbox Code Playgroud)

/module-lib/build.gradle

apply plugin: 'com.android.library'
android {
   ...
}
dependencies{
  api "com.google.firebase:firebase-config:16.0.0"  
}
Run Code Online (Sandbox Code Playgroud)

/module-app/build.gradle

apply plugin: 'com.android.application'
android {
   ...
}
dependencies {
  implementation project(':module-lib') 
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

短日志:

$ ./gradlew clean build

Starting a Gradle Daemon, 1 busy and 2 stopped Daemons could not be reused, use --status for details

Parallel execution is an incubating feature.

> Configure project :module-app
Detected …
Run Code Online (Sandbox Code Playgroud)

android gradle firebase android-gradle-plugin

9
推荐指数
1
解决办法
4985
查看次数

无法在null对象上调用方法version()

我正在尝试使用Jgrapht库,但它需要lambda ...

这是我的代码:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        jcenter()
    }
    dependencies {
        classpath "gradle.plugin.me.tatarka:gradle-retrolambda:3.3.0"
        classpath 'com.android.tools.build:gradle:2.2.1'
    }
}
allprojects {
    repositories {
        jcenter()
        mavenCentral()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)

而且:app

apply plugin: "me.tatarka.retrolambda" version "3.3.0"
apply plugin: 'com.android.application'

android {
    compileSdkVersion 23
    buildToolsVersion "24.0.3"
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "it.univpm.gruppoids.iotforemergencyandnavigation"
        minSdkVersion 16
        targetSdkVersion …
Run Code Online (Sandbox Code Playgroud)

android jgrapht gradle

5
推荐指数
1
解决办法
5506
查看次数