我添加了gradle文件。请检查它们并帮我解决问题。当我从github复制这个项目时,我在gradle sync中遇到了问题 我遵循了每一步。 感谢
// Top-level build file where you can add configuration options common to all sub-projects/modules.enter code here
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// 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
}
task copy_cardboard_images() {
doFirst {
exec {
if (System.properties['os.name'].toLowerCase().contains('windows')) {
// windows
commandLine 'cmd', '/c', 'adb', 'pull', '/mnt/shell/emulated/0/DCIM/CardboardCamera'
} else {
// linux
commandLine 'adb', 'pull', '/mnt/shell/emulated/0/DCIM/CardboardCamera'
}
}
}
doLast {
copy {
from 'CardboardCamera'
into 'website/images'
}
}
}
task remove_cardboard_images() {
doFirst {
exec {
if (System.properties['os.name'].toLowerCase().contains('windows')) {
// windows
commandLine 'cmd', '/c', 'adb', 'shell', 'rm', '-r', '/mnt/shell/emulated/0/DCIM/CardboardCamera'
} else {
// linux
commandLine 'adb', 'shell', 'rm', '-r', '/mnt/shell/emulated/0/DCIM/CardboardCamera'
}
}
}
}
task move_cardboard_images() {
dependsOn copy_cardboard_images
dependsOn remove_cardboard_images
}
Build.gradle : app module
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.google.devrel.vrviewapp"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile project(':gvr-android-sdk/libraries:common')
compile project(':gvr-android-sdk/libraries:commonwidget')
compile project(':gvr-android-sdk/libraries:panowidget')
compile project(':gvr-android-sdk/libraries:videowidget')
}
Settings.gradle :
This code belongs to settings.gradle file
include ':app'
include ':app'
include ':gvr-android-sdk/libraries:audio'
include ':gvr-android-sdk/libraries:base'
include ':gvr-android-sdk/libraries:common'
include ':gvr-android-sdk/libraries:commonwidget'
include ':gvr-android-sdk/libraries:panowidget'
include ':gvr-android-sdk/libraries:videowidget'
答案 0 :(得分:4)
您是否检查过位于Android文件夹中的Android项目的所有依赖项? 里面有settings.gradle文件。在此文件中,将检查项目的每个依赖项。
示例:
include 'your dependencies'
project(':your dependencies').projectDir = new File('path dependencies')
答案 1 :(得分:0)
使用//
评论此行:
//Build.gradle : app module
//Settings.gradle :
//This code belongs to settings.gradle file
然后再试一次
,这似乎gradle
类未正确声明和定义。
答案 2 :(得分:0)
添加:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile project(':gvr-android-sdk/libraries:common')
compile project(':gvr-android-sdk/libraries:commonwidget')
compile project(':gvr-android-sdk/libraries:panowidget')
compile project(':gvr-android-sdk/libraries:videowidget')
}
答案 3 :(得分:0)
您可以使用' settings.gradle'包含外部根项目模块。来自主项目的文件。它也必须是一个gradle项目,并且在特定的Android构建情况下,您必须将每个模块配置为" android-library"插件项目。
例如,在' MyApp' project settings.gradle你可以试试这个:
include 'app'
include 'dagger'
project(':dagger').projectDir = new File('/Users/foo/workspace/stdlib/dagger')
您的MyApp' build.gradle必须反映出“匕首”的需要。模块在相对路径中的Gradle方式:
dependencies {
compile project(':dagger')
}
答案 4 :(得分:0)
步骤:
cmd
npm cache clean --force
将节省我的一天!!