当前位置: 首页 > 知识库问答 >
问题:

我如何从命令行构建这个gradle项目(KotlinParcelize)(Ubuntu 18.04,失败:错误的插件选项格式)?

盖锐
2023-03-14
$ cd /tmp
$ git clone https://github.com/burakeregar/KotlinParcelize.git KotlinParcelize_git
Cloning into 'KotlinParcelize_git'...
remote: Enumerating objects: 75, done.
remote: Total 75 (delta 0), reused 0 (delta 0), pack-reused 75
Unpacking objects: 100% (75/75), done.
$ cd KotlinParcelize_git/
$ ./gradlew assembleDebug
Downloading https://services.gradle.org/distributions/gradle-4.1-all.zip
.....................................................................
Unzipping //home/user/.gradle/wrapper/dists/gradle-4.1-all/bzyivzo6n839fup2jbap0tjew/gradle-4.1-all.zip to //home/user/.gradle/wrapper/dists/gradle-4.1-all/bzyivzo6n839fup2jbap0tjew
Set executable permissions for: //home/user/.gradle/wrapper/dists/gradle-4.1-all/bzyivzo6n839fup2jbap0tjew/gradle-4.1/bin/gradle

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '11.0.8'.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

嗯,那么一个Java问题;我的默认值是Java11,但我也有Java8,所以试一下:

$ apt-show-versions -r openjdk | grep uptodate
openjdk-11-jre:amd64/bionic-security 11.0.8+10-0ubuntu1~18.04.1 uptodate
openjdk-11-jre-headless:amd64/bionic-security 11.0.8+10-0ubuntu1~18.04.1 uptodate
openjdk-8-jdk:amd64/bionic-security 8u265-b01-0ubuntu2~18.04 uptodate
openjdk-8-jdk-headless:amd64/bionic-security 8u265-b01-0ubuntu2~18.04 uptodate
openjdk-8-jre:amd64/bionic-security 8u265-b01-0ubuntu2~18.04 uptodate
openjdk-8-jre-headless:amd64/bionic-security 8u265-b01-0ubuntu2~18.04 uptodate

$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java      1111      manual mode
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode

Press <enter> to keep the current choice[*], or type selection number: 2
update-alternatives: using /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode

好,再试一次:

$ ./gradlew assembleDebug

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s

对,所以我想:

$ echo sdk.dir=/path/to/adt-bundle-linux-x86-20140321/sdk > local.properties 
$ ./gradlew assembleDebug

> Configure project :app
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
Observed package id 'build-tools;19.0.3' in inconsistent location '/path/to/adt-bundle-linux-x86-20140321/sdk/build-tools/android-4.4.2' (Expected '/path/to/adt-bundle-linux-x86-20140321/sdk/build-tools/19.0.3')
Checking the license for package Android SDK Build-Tools 26.0.2 in /path/to/adt-bundle-linux-x86-20140321/sdk/licenses
Warning: License for package Android SDK Build-Tools 26.0.2 not accepted.


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':app'.
> You have not accepted the license agreements of the following SDK components:
  [Android SDK Build-Tools 26.0.2].
  Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
  Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
$ git add -f local.properties # so it does not get deleted by git clean

$ git clean -dxf

$ ./gradlew --stop
Stopping Daemon(s)
1 Daemon stopped

$ ./gradlew assembleDebug
Starting a Gradle Daemon, 5 stopped Daemons could not be reused, use --status for details

> Configure project :app
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
Observed package id 'build-tools;19.0.3' in inconsistent location '/path/to/adt-bundle-linux-x86-20140321/sdk/build-tools/android-4.4.2' (Expected '/path/to/adt-bundle-linux-x86-20140321/sdk/build-tools/19.0.3')
Observed package id 'build-tools;19.0.3' in inconsistent location '/path/to/adt-bundle-linux-x86-20140321/sdk/build-tools/android-4.4.2' (Expected '/path/to/adt-bundle-linux-x86-20140321/sdk/build-tools/19.0.3')

e: Wrong plugin option format: null, should be plugin:<pluginId>:<optionName>=<value>

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 10s
12 actionable tasks: 12 executed
...
12:05:09.468 [DEBUG] [sun.rmi.transport.tcp] RMI TCP Connection(2)-127.0.0.1: accepted socket from [127.0.0.1:26356]
12:05:09.469 [DEBUG] [sun.rmi.transport.tcp] RMI TCP Connection(2)-127.0.0.1: (port 1757) op = 80
12:05:09.469 [DEBUG] [sun.rmi.loader] RMI TCP Connection(2)-127.0.0.1: name = "[Ljava.rmi.server.ObjID;", codebase = "", defaultLoader = sun.misc.Launcher$ExtClassLoader@3d7dbe2d
12:05:09.469 [DEBUG] [sun.rmi.loader] RMI TCP Connection(2)-127.0.0.1: name = "java.rmi.server.ObjID", codebase = "", defaultLoader = sun.misc.Launcher$ExtClassLoader@3d7dbe2d
12:05:09.470 [DEBUG] [sun.rmi.loader] RMI TCP Connection(2)-127.0.0.1: name = "java.rmi.server.UID", codebase = "", defaultLoader = sun.misc.Launcher$ExtClassLoader@3d7dbe2d
12:05:09.470 [DEBUG] [sun.rmi.loader] RMI TCP Connection(2)-127.0.0.1: name = "java.rmi.dgc.Lease", codebase = "", defaultLoader = sun.misc.Launcher$ExtClassLoader@3d7dbe2d
12:05:09.472 [DEBUG] [sun.rmi.loader] RMI TCP Connection(2)-127.0.0.1: name = "java.rmi.dgc.VMID", codebase = "", defaultLoader = sun.misc.Launcher$ExtClassLoader@3d7dbe2d
12:05:09.473 [DEBUG] [sun.rmi.loader] RMI TCP Connection(2)-127.0.0.1: name = "[B", codebase = "", defaultLoader = sun.misc.Launcher$ExtClassLoader@3d7dbe2d
12:05:09.488 [DEBUG] [sun.rmi.transport.tcp] RMI TCP Connection(2)-127.0.0.1: (port 1757) op = 82
12:05:09.488 [DEBUG] [sun.rmi.transport.tcp] RMI TCP Connection(2)-127.0.0.1: (port 1757) op = 80
12:05:09.521 [DEBUG] [sun.rmi.transport.tcp] RMI TCP Connection(2)-127.0.0.1: (port 1757) op = 82
12:05:09.526 [DEBUG] [sun.rmi.transport.tcp] RMI TCP Connection(2)-127.0.0.1: (port 1757) op = 80
12:05:09.526 [ERROR] [org.gradle.api.Task] e: Wrong plugin option format: null, should be plugin:<pluginId>:<optionName>=<value>
12:05:09.532 [DEBUG] [sun.rmi.transport.tcp] RMI TCP Connection(2)-127.0.0.1: (port 1757) op = 80
12:05:09.533 [DEBUG] [sun.rmi.loader] RMI TCP Connection(2)-127.0.0.1: name = "org.jetbrains.kotlin.daemon.report.CompileIterationResult", codebase = ""
12:05:09.533 [DEBUG] [sun.rmi.loader] RMI TCP Connection(2)-127.0.0.1: name = "java.util.LinkedHashSet", codebase = ""
12:05:09.533 [DEBUG] [sun.rmi.loader] RMI TCP Connection(2)-127.0.0.1: name = "java.util.HashSet", codebase = ""
12:05:09.533 [DEBUG] [sun.rmi.loader] RMI TCP Connection(2)-127.0.0.1: name = "java.io.File", codebase = ""
12:05:09.534 [DEBUG] [org.gradle.api.Project] [KOTLIN] compile iteration: app/src/main/java/com/burakeregar/kotlinparcelize/MainActivity.kt, app/src/main/java/com/burakeregar/kotlinparcelize/PersonModel.kt, app/src/main/java/com/burakeregar/kotlinparcelize/SecondActivity.kt
...
    null

共有1个答案

宗政浩慨
2023-03-14

好了,最后用Android Studio4.0.1打开了这个项目,并且:

  • 将project中的gradle更新到6.1.1(从原来的4.1)
  • 从1.2.0更新到ext.kotlin_version=“1.3.72”
  • 使用了kotlin-stdlib-jdk7而不是kotlin-stdlib-jre7(因为我在某处收到了一条弃用消息)

...现在我不再得到“错误的插件选项格式”了--但是现在我得到了“类'PersonModel'不是抽象的,并且不实现抽象成员公共抽象...”--我将问一个新的问题。

 类似资料:
  • 当我尝试使用以下命令用gradle构建一个android项目时: 它给了我这个错误: 我可以建立这个项目,并使APK在工作室。

  • 我有一个gradle多项目构建,每个子项目都在单独的git存储库中。在根项目的build.gradle,我试图为所有子项目定义一个任务,它将为每个项目执行一些git命令。但是,任务的工作目录始终是根项目的工作目录。 如何根据当前执行任务的子项目更改workingDir?

  • 如何从命令行(没有任何IDE)创建带有Android项目? 在使用util之前,如下所示

  • 问题内容: 有没有一种方法可以从命令行编译基于Eclipse的Java项目? 我正在尝试自动化我的构建(不是使用FinalBuilder蚂蚁),而且我既不是Java专家也不是Eclipse专家。我可能可以弄清楚如何使用直接的Java命令行选项来执行此操作,但是Eclipse项目感觉像是在浪费很多精力。 如果无法通过命令行编译Eclipse项目,是否可以从Eclipse内部生成所需的Java命令行?

  • 有人能帮我解决这个错误吗? 我把ADS放在我的项目中,当我尝试将我的项目构建到Android时,我得到了这个错误。 但是,如果我将ADS脱机,那么错误就会消失。 命令调用失败:Gradle 构建失败。C:/Program Files/Java/jdk1.8.0_45\bin\java.exe -classpath “E:\unity 5\Editor\Data\PlaybackEngines\An