2017-11-24 15 views
0

にアップグレードしてもプロジェクトが作成されないプロジェクトでグラデーションの設定が変更されました。そのうちの一つで 私はビルドをやろうとしている間エラーが発生します:私はラインをエラーに移動するときAndroid 3.0に移行した後、アンドロイド・グラデル・プラグイン3.0.0 +

Execution failed for task ':app:compileDebugKotlin'. 

e: C:\dev\myapp\app\src\main\kotlin\com\xxxxx\dialog\DeleteConfirmDialog.kt: (35, 46): Too many arguments for public constructor Builder(p0: Context!) defined in android.app.AlertDialog.Builder 
e: C:\dev\myapp\app\src\main\kotlin\com\xxxxx\dialog\HumidityThresholdDialog.kt: (46, 74): Too many arguments for public open fun getString(p0: String!): String! defined in android.os.Bundle 
e: C:\dev\myapp\app\src\main\kotlin\com\xxxxx\dialog\PermissionDialog.kt: (45, 50): Unresolved reference: ACTION_APcomICATION_DETAILS_SETTINGS 
e: C:\dev\myapp\app\src\main\kotlin\com\xxxxx\dialog\PermissionDialog.kt: (53, 22): Unresolved reference: finishAffinity 
e: C:\dev\myapp\app\src\main\kotlin\com\xxxxx\dialog\TemperatureThresholdDialog.kt: (74, 73): Unresolved reference: holo_red_dark 
e: C:\dev\myapp\app\src\main\kotlin\com\xxxxx\dialog\TemperatureThresholdDialog.kt: (81, 88): Unresolved reference: holo_red_dark 
e: C:\dev\myapp\app\src\main\kotlin\com\xxxxx\fragment\Thresholds.kt: (128, 41): Unresolved reference: fragmentManager 
e: C:\dev\myapp\app\src\main\kotlin\com\xxxxx\fragment\Thresholds.kt: (153, 38): Unresolved reference: fragmentManager 
... 

例えば、面白いとは何ですか:

val color = if (it) android.R.color.black else android.R.color.holo_red_dark //Unresolved reference: holo_red_dark 
dialog.show(activity.fragmentManager, ThresholdDialog::class.java.simpleName) //Unresolved reference: fragmentManager 

コンパイラはエラーが表示されません私はそれらのクラスに移動することができます。

プロジェクト:

buildscript { 
    repositories { 
     google() 
     jcenter() 
     maven { url 'https://raw.github.com/vRallev/mvn-repo/master/' } 
     maven { url 'https://maven.fabric.io/public' } 
     mavenCentral() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.1' //<--- when reverting back to 2.3.3, the project is built without problems 
     classpath 'io.fabric.tools:gradle:1.23.0' 
    } 
} 

allprojects { 
    repositories { 
     google() 
     jcenter() 
     mavenCentral() 
     maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } 
    } 
} 

アプリケーション:

buildscript { 
    ext.versions = [ 
      kotlin  : '1.1.60', 
      crashlytics: '1.16.0' 
    ] 

    repositories { 
     mavenCentral() 
     maven { url 'http://download.crashlytics.com/maven' } 
     maven { url "https://plugins.gradle.org/m2/" } 
     maven { url 'https://maven.fabric.io/public' } 
    } 

    dependencies { 
     classpath "com.crashlytics.tools.gradle:crashlytics-gradle:$versions.crashlytics" 
     classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$versions.kotlin" 
     classpath "org.jetbrains.kotlin:kotlin-android-extensions:$versions.kotlin" 
     classpath "org.kordamp:markdown-gradle-plugin:1.1.0" 
     classpath 'io.fabric.tools:gradle:1.23.0' 
    } 
} 

repositories { 
    maven { url 'https://maven.fabric.io/public' } 
    maven { url 'https://jitpack.io' } 
    mavenLocal() 
    mavenCentral() 
} 

apply plugin: 'com.android.application' 
apply plugin: 'io.fabric' 
apply plugin: 'kotlin-android' 
apply plugin: 'kotlin-kapt' 
apply plugin: 'kotlin-android-extensions' 
apply plugin: 'org.kordamp.markdown.convert' 

apply from: 'signing.gradle' 

def version = ["major": 3, "minor": 6, "patch": 1, "build": 0] 

android { 
    compileSdkVersion 26 
    buildToolsVersion '26.0.2' 

    defaultConfig { 
     applicationId "com.xxxxx" 
     minSdkVersion 19 
     targetSdkVersion 26 
     versionCode 10000000 * version["major"] + 100000 * version["minor"] + 1000 * version["patch"] + version["build"] 
     versionName "${version["major"]}.${version["minor"]}.${version["patch"]}" 
    } 

    compileOptions { 
     sourceCompatibility JavaVersion.VERSION_1_7 //<- tried to changed to 1_8 with android studio 3, doesn't help 
     targetCompatibility JavaVersion.VERSION_1_7 
    } 

    signingConfigs { 
     release 
    } 

    buildTypes { 
     release { 
//   runProguard false 
//   proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
      zipAlignEnabled true 
      signingConfig signingConfigs.release 

     } 
     debug { 
      ext.enableCrashlytics = false 
     } 
    } 

    sourceSets { 
     main.java.srcDirs += 'src/main/kotlin' 
     main.assets.srcDirs += 'build/gen-html' 
     androidTest.java.srcDirs += 'src/androidTest/kotlin' 
    } 

    lintOptions { 
     checkReleaseBuilds false 
     disable 'InvalidPackage' 
    } 

    packagingOptions { 
     exclude 'META-INF/services/javax.annotation.processing.Processor' 
     exclude 'META-INF/LICENSE.txt' 
    } 
} 

ext.versions += [ 
     supportLib : "26.1.0", 
     logback : '1.1.1-2', 
     dagger  : '1.2.5', 
     butterknife: '7.0.1' 
] 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) //changed all 'compile' to 'implementation', doesn't help 

    compile 'com.xxxxx.lib:[email protected]' 

    compile "com.android.support:support-v4:$versions.supportLib" 
    compile "com.android.support:support-v13:$versions.supportLib" 
    compile "com.squareup.dagger:dagger:$versions.dagger" 
    compile 'com.squareup.retrofit2:retrofit:2.0.0-beta3' 
    compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta3' 
    compile 'com.google.guava:guava:20.0' 
    compile 'de.greenrobot:eventbus:2.2.1' 
    compile 'org.slf4j:slf4j-api:1.7.6' 
    compile "com.github.tony19:logback-android-core:$versions.logback" 
    compile "com.github.tony19:logback-android-classic:$versions.logback" 
    compile "org.jetbrains.kotlin:kotlin-stdlib:$versions.kotlin" 
    compile 'io.reactivex:rxjava:1.0.16' 
    compile 'io.reactivex:rxkotlin:0.40.1' 
    compile "com.jakewharton.rxbinding:rxbinding:0.4.0" 
    compile "com.jakewharton.rxbinding:rxbinding-kotlin:0.4.0" 
    compile "com.jakewharton:butterknife:$versions.butterknife" 
    compile 'com.jakewharton.threetenabp:threetenabp:1.0.3' 

    compile('com.crashlytics.sdk.android:crashlytics:[email protected]') { transitive = true } 
    compile 'com.github.PhilJay:MPAndroidChart:v2.0.7' 

    kapt "com.jakewharton:butterknife:$versions.butterknife" 
    kapt "com.squareup.dagger:dagger-compiler:$versions.dagger" 

    testCompile 'junit:junit:4.12' 
    testCompile 'org.mockito:mockito-core:2.9.0' 
    testCompile 'org.assertj:assertj-core:3.8.0' 
} 

markdownToHtml { 
    sourceDir = file('src/main/markdown') 
    fencedCodeBlocks = true 
    hardwraps = true 
    autoLinks = true 
} 

project.afterEvaluate { 
    tasks.findByName('mergeDebugAssets')?.dependsOn tasks['markdownToHtml'] 
    tasks.findByName('mergeReleaseAssets')?.dependsOn tasks['markdownToHtml'] 
} 

何の問題だろうか?

答えて

1

私は依存関係ツリーを見て、ログバックライブラリが古いアプリケーションライブラリを使用していて、それがgradleフォームリポジトリに引っ張られて不思議にプロジェクトをコンパイルするのに気付いた。

+--- com.github.tony19:logback-android-classic:1.1.1-2 
| +--- com.github.tony19:apktool-lib:1.4.4-3 
| | \--- com.google.android:android:2.1_r1 

gradle依存関係から除外した後、プロジェクトが正しく構築され始めました。

implementation('com.github.tony19:logback-android-classic:1.1.1-6') { 
    exclude group: 'com.google.android', module: 'android' 
} 
関連する問題