本文介绍了无法在空对象上调用方法version()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

i'm trying to use the Jgrapht library but it needs lambdas...

这是我的代码:

    // 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
}

和: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 23
        versionCode 1
        versionName "1.0"

       jackOptions {
            enabled true
        }
    }



    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.journeyapps:zxing-android-embedded:3.2.0@aar'
    compile 'com.google.zxing:core:3.2.1'
    compile 'org.jgrapht:jgrapht-core:1.0.0'
}

错误是:错误:(1,0)无法在空对象上调用方法version()打开文件错误在哪里,是什么?谢谢

The error is: Error:(1, 0) Cannot invoke method version() on null objectOpen FileWhere and what is the error? thanks

推荐答案

您正在混合两种语法.使用任何一个

You're mixing two kinds of syntaxes. Use either

buildscript {
    repositories {
       mavenCentral()
    }
    dependencies {
        classpath "gradle.plugin.me.tatarka:gradle-retrolambda:3.3.0"
    }
}

apply plugin: 'me.tatarka.retrolambda'

plugins {
  id "me.tatarka.retrolambda" version "3.3.0"
}

( gradle-retrolambda自述文件),另请参见 gradle文档.

这篇关于无法在空对象上调用方法version()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 03:36