Instabug for Android构建警告

前端之家收集整理的这篇文章主要介绍了Instabug for Android构建警告前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我们有一个包含4个模块的gradle项目:1个库模块和3个 Android应用程序.要构建我们的应用程序,我们使用circleCI.我们还在 this指南之后禁用了circleCI构建的预定义.

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

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

Ignoring InnerClasses attribute for an anonymous inner class
(com.instabug.library.b) that doesn’t come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source,using an up-to-date compiler
and without specifying any “-target” type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is not an inner class.

我假设由于为“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","${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
            }
    ]
}

信息亭模块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",'"prod"'
        }

//        dev developmentFlavor

    }


}

dependencies kiosk.dependencies

解决方法

我对这个问题没有真正的答案.但是preDex任务是由于minSdkVersion 21而创建的.另外,我们不能将自己限制在4GB内存,因此我们不得不将其提升到6GB.
原文链接:https://www.f2er.com/android/314702.html

猜你在找的Android相关文章