问题:

我正在尝试使用Gradle构建我的第一个项目,我认为我的gradle文件和设置是正确的。

我只使用一个模块和支持V4 + AppCompatBar库。

项目 – build.gradle

allprojects {
    repositories {
        mavenCentral()
    }
}

项目 – settings.gradle

include ':AssignmentTempos21'

主模块 – build.gradle

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}

apply plugin: 'android'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 17
    buildToolsVersion "17.0.0"

    defaultConfig {
        minSdkVersion 8
        targetSdkVersion 17
    }
}

dependencies {
    compile "com.android.support:support-v4:18.0.+"
    compile "com.android.support:appcompat-v7:18.0.+"
}

带-i标志的控制台输出:

MacBook-Air-de-Cesar-2:AssignmentTempos21 menor$ ./gradlew -i clean assemble
Starting Build
Settings evaluated using settings file '/Users/menor/workspace_android/AssignmentTempos21/settings.gradle'.
Projects loaded. Root project using build file '/Users/menor/workspace_android/AssignmentTempos21/build.gradle'.
Included projects: [root project 'AssignmentTempos21', project ':AssignmentTempos21']
Evaluating root project 'AssignmentTempos21' using build file '/Users/menor/workspace_android/AssignmentTempos21/build.gradle'.
Compiling build file '/Users/menor/workspace_android/AssignmentTempos21/build.gradle' using BuildScriptClasspathScriptTransformer.
Compiling build file '/Users/menor/workspace_android/AssignmentTempos21/build.gradle' using BuildScriptTransformer.
Evaluating project ':AssignmentTempos21' using build file '/Users/menor/workspace_android/AssignmentTempos21/AssignmentTempos21/build.gradle'.
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/support-v4/]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/support-v4/]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/support-v4/]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/support-v4/]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/appcompat-v7/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/appcompat-v7/]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/appcompat-v7/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/appcompat-v7/]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/appcompat-v7/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/appcompat-v7/]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/appcompat-v7/maven-metadata.xml]
Resource missing. [HTTP GET: http://repo1.maven.org/maven2/com/android/support/appcompat-v7/]

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':AssignmentTempos21'.
> Failed to notify project evaluation listener.
   > Could not resolve all dependencies for configuration ':AssignmentTempos21:_DebugCompile'.
      > Could not find any version that matches com.android.support:support-v4:18.0.+.
        Required by:
            AssignmentTempos21:AssignmentTempos21:unspecified
      > Could not find any version that matches com.android.support:appcompat-v7:18.0.+.
        Required by:
            AssignmentTempos21:AssignmentTempos21:unspecified

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

BUILD FAILED

Total time: 40.787 secs

先感谢您!!

I’m trying to build my first project with Gradle and I think my gradle files and settings are correct.I’m using only one module and Support V4 + AppCompatBar libraries.Project – build.gradleProject – settings.gradleMain module – build.gradleConsole output with -i flag:Thank you in advance!!

问题:

我更新了android studio 2.3,但有一个错误,gradle无法构建,并且在所有项目中都给我同样的错误。

Error:Failed to open zip file.
Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
<a href="syncProject">Re-download dependencies and sync project (requires network)</a>
<a href="syncProject">Re-download dependencies and sync project (requires network)</a>

我已经在寻找解决方案,但是没有找到任何解决方案。 我试过了:

Invalidate Caches / Restart...

但是什么都没有改变。

I updated android studio 2.3 and there is a bug, gradle doesn’t build and it keeps giving me the same error for all projects.I have already searched for a solution, but have not found any.I tried:but nothing has changed.

问题:

我有一个由两个模块组成的IntelliJ 14.1.2项目-一个是基于Android Gradle的模块,另一个是具有Maven的基于Spring Java的模块。

gps-trackman.v1是我的根项目,并且我没有为此项目配置任何输出或构面。 该应用程序是我的android gradle模块,并且我已经为此项目配置了Android和Android-Gradle Facet,而gps-trackman不是我的Spring Maven项目。 我希望能够一起构建所有内容。 可能吗?

我现在在IntelliJ Eventlog中收到此错误消息

检测到不支持的模块:以下模块不支持编译:gps-trackman,gps-trackman.v1,应用程序。 不幸的是,您不能在一个项目中拥有非Gradle Java模块和Android-Gradle模块。

项目’gps-trackman.v1’不是基于Gradle的

这个错误是由于我的项目配置错误导致的,还是真的不可能在一个项目中拥有Maven模块和Gradle模块?

我是否需要为根项目配置任何方面? 另外,我必须将我的Maven转换为gradle吗?

I have an IntelliJ 14.1.2 Project consisting of two modules – one is an Android Gradle based module and the other is a Spring Java-based module with Maven.gps-trackman.v1 is my root project and I’ve not configured any outputs or facets for this project.The app is my android gradle module and I’ve configured Android and Android-Gradle Facet for this project and gps-trackman isn’t my Spring Maven Project.I want to be able to build everything all together.Is it possible?I now get this error message in my IntelliJ EventlogUnsupported Modules Detected: Compilation is not supported for following modules: gps-trackman, gps-trackman.v1, app.Unfortunately you can’t have non-Gradle Java modules and Android-Gradle modules in one project.The project ‘gps-trackman.v1’ is not a Gradle-basedIs this error just due to a misconfiguration of my project or is it really not possible to have a maven module and a Gradle module in one project?Do I have to configure any Facets for the root project?Alternatively, do I have to convert my maven to gradle?

问题:

我正在MacOS上工作,只是从react-native

开始的第一步就是运行: react-native run-androidreact-native run-ios 但我收到此错误:

react-native run-android

结果:

Scanning folders for symlinks in /Users/ric/myprojs/albums/node_modules (6ms)
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...

FAILURE: Build failed with an exception.

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

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

这是我运行java --version时得到的:

java --version

结果:

java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
mbp:albums ric$ java --version
java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

编辑

我的javac版本:

javac --version

结果:

javac 9.0.1

关于如何解决此问题的任何想法?

I’m working on MacOS and just starting with react-native .One of the first steps to get started is to run: react-native run-android or react-native run-ios .But I’m getting this error:Result:This is what I get when I run java --version :Result:EditMy javac version:Result:Any idea on how to fix this?

问题:

Android Studio(1.2 RC0)一直告诉我Error running android: Gradle project sync failed. Please fix your project and try again. Error running android: Gradle project sync failed. Please fix your project and try again. 我如何找出问题所在? 不幸的是, 这个SO线程的解决方案没有帮助。

Android Studio (1.2 RC0) keeps telling me Error running android: Gradle project sync failed. Please fix your project and try again.How can I find out what the problem is?Unfortunately the solutions from this SO thread did not help.