我尝试从GitHub导入项目并在Android Studio上构建/运行它。我收到以下错误:
"错误:无法创建Tooling API实现的实例 使用指定的Gradle分布 ' https://services.gradle.org/distributions/gradle-2.4-all.zip'"
我尝试了以下内容:
这些是我在stackoverflow上从其他几篇文章中得到的想法,所以我无法解释为什么我尝试这些。 (我对Android Studio非常陌生)。
我的build.gradle
文件如下所示:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
} }
allprojects {
repositories {
jcenter()
} }
task clean(type: Delete) {
delete rootProject.buildDir }
答案 0 :(得分:0)
请改变
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
带
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
然后改变
classpath 'com.android.tools.build:gradle:1.5.1'
带
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
它应该有用。
答案 1 :(得分:0)
对我来说,我认为这是许可问题。从Eclipse,我也遇到过同样的问题。在我的gradle安装路径(即/ opt / gradle)上,将其chmod设置为777。以便其他工具可以访问它。运行以下2个命令-
cd /opt
sudo chmod 777 -R gradle
答案 2 :(得分:0)
Java版本> 9和Gradle版本> = 5.0.0有一些代码中断更改。这里是使用Eclipse解决它们的方法。在AndroidStudio中应该类似。
这对我有用,我在运行Eclipse 2018-12时在Windows 10上将LibGDX与Java 11和Gradle 5.2.1结合使用。
答案 3 :(得分:0)
我遇到了类似的问题,更新了 const orderSchema = mongoose.Schema({
id: mongoose.Schema.Types.ObjectId,
product: { type: mongoose.Schema.Types.ObjectId, ref: 'Product',
required:
true },
quantity: { type: Number, default: 1 }
});
const productSchema = mongoose.Schema({
_id: mongoose.Schema.Types.ObjectId,
name: { type: String, required: true },
price: { type: Number, required: true },
productImage: { type: String }
});
中的Gradle
版本就解决了。
distributionUrl
字段位于此目录下:
distributionUrl
答案 4 :(得分:0)
尝试删除 ~/.gradle/wrapper/dists 中的文件夹 gradle-2.4-all