【问题标题】:Instabug for Android build warningInstabug for Android 构建警告
【发布时间】:2015-07-20 15:07:20
【问题描述】:

我们有一个包含 4 个模块的 gradle 项目:1 个库模块和 3 个 android 应用程序。为了构建我们的应用程序,我们使用 circleCI。我们还按照this 指南禁用了circleCI 构建的predex-ing。

在我将 Instabug 添加到我们的一个项目之前,一切都很棒。从那以后,我们一直在达到 circleCI 4GB 的限制。最重要的是,无论如何,将 Instabug 作为依赖项的项目将启动 preDex gradle 任务。要开始新的构建,我们使用以下命令:./gradlew assembleDebug -PpreDexEnable=false

使用 Instabug 的项目在构建时会收到一些警告,如下所示:

忽略匿名内部类的 InnerClasses 属性 (com.instabug.library.b) 不附带 关联的 EnclosureMethod 属性。这个类可能是由一个 不针对现代 .class 文件格式的编译器。推荐的 解决方案是使用最新的编译器从源代码重新编译类 并且没有指定任何“-target”类型选项。忽视的后果 此警告是此类上的反射操作将错误地 表明它不是一个内部类。

我假设由于为“Instabug 项目”启动的 preDex 任务,我们达到了 4 GB 的限制。

有人知道发生了什么吗?

编辑:gradle 文件

root 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.2.3'
        classpath 'de.hannesstruss:godot:0.2'
        classpath 'com.github.ben-manes:gradle-versions-plugin:0.11.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

apply plugin: 'de.hannesstruss.godot'
apply plugin: 'com.github.ben-manes.versions'
apply from: 'dependencies.gradle'

def ciServer = 'CI'
def executingOnCI = "true".equals(System.getenv(ciServer))

ext {
    // preDexEnable property will come from the command line when circleCI is building the project.
    if (project.hasProperty('preDexEnable')) {
        project.ext.preDexLibs = project.properties['preDexEnable'].equals('true')
    } else {
        project.ext.preDexLibs = true // pre dexing should be true by default
    }

    buildTime = new Date().format("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC"))

    developmentFlavor = {
        applicationId "${project.ext.appId}.${name}"
        versionName "${project.ext.verName}-${name}"
        minSdkVersion 15
        buildConfigField "String", "API_TYPE", "\"${name}\""
        resValue "string", "tray__authority", "${applicationId}.tray"
    }

    defaultLibraryFlavorConfig = {
        targetSdkVersion 22
        versionCode project.ext.verCode
        versionName project.ext.verName

        multiDexEnabled true

        buildConfigField "String", "GIT_SHA", "\"${project.ext.gitSha}\""
        buildConfigField "String", "BUILD_TIME", "\"${buildTime}\""
    }

    defaultFlavorConfig = defaultLibraryFlavorConfig << {
        applicationId project.ext.appId
        resValue "string", "tray__authority", "${applicationId}.tray"
    }

    defaultAndroidConfig = {
        compileSdkVersion 22
        buildToolsVersion "22.0.1"

        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_7
            targetCompatibility JavaVersion.VERSION_1_7
        }

        dexOptions {
            javaMaxHeapSize executingOnCI ? "2048m" : "4g"
            jumboMode true
        }

        packagingOptions {
            exclude 'META-INF/DEPENDENCIES.txt'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'
            exclude 'META-INF/NOTICE'
            exclude 'META-INF/LICENSE'
            exclude 'META-INF/DEPENDENCIES'
            exclude 'META-INF/notice.txt'
            exclude 'META-INF/license.txt'
            exclude 'META-INF/dependencies.txt'
            exclude 'META-INF/LGPL2.1'
            exclude 'META-INF/services/javax.annotation.processing.Processor'
        }

        lintOptions {
            checkReleaseBuilds false
            // Or, if you prefer, you can continue to check for errors in release builds,
            // but continue the build even when errors are found:
            abortOnError false
        }
    }
}

subprojects {
    repositories {
        maven { url "http://dl.bintray.com/populov/maven" }
        jcenter()
    }

    project.ext.gitSha = 'git rev-parse --short HEAD'.execute([], project.projectDir).text.trim()

    project.plugins.whenPluginAdded { plugin ->
        if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) {
            project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
        } else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
            project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
        }
    }
}

dependencies.gradle

ext {
    kiosk = [
            dependencies: {
                compile project(':common')

                compile libraries.multidex
                compile libraries.viewPagerIndicator
                compile libraries.recyclerview
                compile libraries.volley
                compile libraries.instabug
                compile libraries.mixpanel
                compile libraries.loadToast
                compile(libraries.crashlytics) {
                    transitive = true;
                }

                compile libraries.dagger
                apt libraries.daggerCompiler
                provided libraries.javaxAnnotations
            }
    ]
}

kiosk 模块 build.gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/repo' }
        jcenter()
    }

    dependencies {
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.6'
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

repositories {
    maven { url 'https://maven.fabric.io/public' }
    maven { url 'http://archiva.instabug.com/repository/release' }
    maven { url "https://jitpack.io" }
}

apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'io.fabric'

// Manifest version information!
def versionMajor = 1
def versionMinor = 0
def versionPatch = 0
def versionBuild = 0 // bump for dogfood builds, public betas, etc.

ext.verCode = versionMajor * 10000 + versionMinor * 1000 + versionPatch * 100 + versionBuild
ext.verName = "${versionMajor}.${versionMinor}.${versionPatch}"

ext.appId = 'care.smart.android.kiosk'

android defaultAndroidConfig << {

    defaultConfig defaultFlavorConfig << {
        minSdkVersion 21
        buildConfigField "String", "APP_NAME", "\"Android-Kiosk\""
    }

    productFlavors {
        realProduction {
            buildConfigField "String", "API_TYPE", '"prod"'
        }

//        dev developmentFlavor

    }


}

dependencies kiosk.dependencies

【问题讨论】:

  • 这是来自 CircleCI 的 Kim。你能在我们的支持上发布同样的问题吗?我们可以在那里为您提供更好的支持。得到答案后,您可以将其发回此处。谢谢!
  • 这是来自 Instabug 的 Hassan。该警告很烦人,但它不应该引起任何问题。关于 SO here 的相关问题。不过,我们将在未来的版本中消除该警告。关于 preDex 任务,这是否也在本地发生?还是只在 CircleCI 上?
  • 它发生在两个地方,本地和circleCI。
  • 我无法在本地复制这个,你能把你的根 build.gradle 添加到问题中吗?
  • @HassanIbraheem 我添加了相关的 gradle 构建文件。

标签: android circleci instabug


【解决方案1】:

我对这个问题没有真正的答案。但是preDex 任务是由于minSdkVersion 21 而创建的。此外,我们无法将自己的 RAM 限制为 4GB,因此我们不得不将其提高到 6GB。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-05-24
    • 1970-01-01
    相关资源
    最近更新 更多