目前在https://github.com/lucasr/probe的分支上工作。刚开始时,但是由于某种原因,当我尝试构建它时,多次出现此错误:

/Users/me/probe/library/src/main/java/org/lucasr/probe/DexProxyBuilder.java:27: error: package com.google.dexmaker does not exist
import com.google.dexmaker.Code;

我真的不知道怎么回事,因为库项目的build.gradle有:
dependencies {
    compile 'com.google.dexmaker:dexmaker:1.2'
}

编辑:完整build.gradle
apply plugin: 'com.android.library'
apply plugin: 'maven'

repositories {
    mavenCentral()
}

android {
    compileSdkVersion 19
    buildToolsVersion "21.1.2"
}

dependencies {
    compile 'com.google.dexmaker:dexmaker:1.2'
}

apply from: "${rootDir}/gradle/scripts/gradle-mvn-push.gradle"

afterEvaluate { project ->
    uploadArchives {
        repositories {
            mavenDeployer {
                pom.whenConfigured {
                    def dep = dependencies.find { it.groupId == 'com.google.dexmaker' }
                    dep.optional = true
                    dep.scope = null
                }
            }
        }
    }
}

最佳答案

dexmaker Github说:

Gradle用户可以通过以下方式导入项目:

testCompile "com.crittercism.dexmaker:dexmaker:1.4"
testCompile "com.crittercism.dexmaker:dexmaker-dx:1.4"
testCompile "com.crittercism.dexmaker:dexmaker-mockito:1.4"

10-01 14:50