build gradle:变量名称无效,必须以字母开头但是'lib'

时间:2017-03-17 14:52:00

标签: android parse-platform

[在此输入图片说明] [1] 强文 [在此输入图片说明] [2]

我是新的Android ..并面临这个问题,以启动解析服务器

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.yasir.jsaljlaj"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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 'com.android.support:appcompat-v7:25.2.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.parse:parse-android:1.13.3'
    compile 'com.parse.bolts:bolts-tasks:1.4.0'
    compile 'com.parse.bolts:bolts-applinks:1.4.0'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.3.0'
    compile fileTree(dir:’libs’,include:[‘*.jar’])
}

这是错误

错误:(37,0)启动失败: 构建文件'C:\ Users \ yasir \ Downloads \ Jsaljlaj \ app \ build.gradle':37:变量名无效。必须以字母开头,但是:'libs' 。在[37:26] @第37行,第26栏。        编译fileTree(dir:'libs',include:['*。jar'])                             ^

1错误

打开文件

1 个答案:

答案 0 :(得分:0)

将编译fileTree行放在依赖项括号内。

另请注意,您应该只有一个依赖项部分,所以

dependecies{
//all your dependencies here
}

修改

删除括号前的最后一行代码:

compile fileTree(dir:’libs’,include:[‘*.jar’]);

删除此内容,一切正常