2015-07-20 97 views
7

我們有一個包含4個模塊的gradle項目:1個庫模塊和3個android應用程序。要構建我們的應用程序,我們使用circleCI。我們還禁止使用this指南中的circleCI版本預定義。Instabug for Android構建警告

一切都很好,直到我加入Instabug到我們的項目之一。自那以後,我們一直在達到circleCI 4GB的限制。最重要的是,將Instabug作爲依賴的項目將啓動preDex gradle任務,無論如何。要開始一個新版本,我們使用以下命令:./gradlew assembleDebug -PpreDexEnable=false

使用Instabug該項目在編譯的時候像這樣得到一些警告:

忽略InnerClasses屬性爲一個匿名內部類 (com.instabug.library.b)不拿出一個 關聯的EnclosingMethod屬性。這個類可能是由一個 編譯器生成的,它不針對現代.class文件格式。建議的 解決方案是使用最新的編譯器 並且不指定任何「-target」類型選項,從源代碼重新編譯該類。忽略 這個警告的結果是,對這個類的反射操作將錯誤地 指示它是而不是的一個內部類。

我假設我們已經達到了4GB的限制,這是因爲「Instabug項目」啓動的preDex任務。

有沒有人有什麼想法是怎麼回事?

編輯:文件的gradle

根的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 
      } 
    ] 
} 

亭模塊的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 
+0

這是來自Instabug的Hassan。該警告令人討厭,但不應該導致任何問題。關於SO [這裏]的相關問題(http://stackoverflow.com/questions/3308010/what-is-the-ignoring-innerclasses-attribute-warning-output-during-compilation/3308059)。儘管如此,我們將在未來的版本中擺脫這種警告。關於preDex任務,這是否也在本地發生?或者只是在CircleCI上? –

+0

它發生在兩地,本地和circleCI。 –

+1

我無法在本地複製此內容,您可以將您的root build.gradle添加到問題中嗎? –

回答

4

我對這個問題沒有真正的答案。但preDex任務是由於minSdkVersion 21而創建的。此外,我們不能將自己限制在4GB的RAM中,因此我們不得不將其升高到6GB。