我在Android Studio 3中重建项目时收到多个警告(我认为当我从2.3切换到Android studio 3时会出现警告)
以下是我的build.gradle文件:
根/
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
kotlin_version = '1.1.51'
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta7'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "http://jcenter.bintray.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
应用程序/ SRC /
apply plugin: 'kotlin-kapt'
apply plugin: 'org.greenrobot.greendao'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.1'
}
defaultConfig {
applicationId "com.example"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
abortOnError false
}
testOptions {
unitTests {
returnDefaultValues = true
includeAndroidResources = true
}
}
}
configurations.all {
exclude group: 'org.jetbrains', module: 'annotations'
}
greendao {
schemaVersion 2
}
ext {
test_runner_version = '1.0.1'
espresso_core_version = '2.2.2'
kotlin_version = '1.1.51'
anko_version = '0.10.1'
rxjava_version = '2.1.3'
rxbinding_version = '2.0.0'
dagger_version = '2.12'
javax_annotation_version = '10.0-b28'
jsr250_api_version = '1.0'
MPAndroidChart_version = 'v3.0.2'
greendao_version = '3.2.2'
transitionseverywhere_version = '1.7.5'
materialprogressbar_version = '1.4.1'
play_services_fitness_version = '11.4.2'
kotlinx_coroutines_version = '0.16'
android_support_version = '26.1.0'
constraint_layout_version = '1.0.2'
funktionale_version = '1.1'
joda_time_version = '2.9.9'
retrofit2_version = '2.3.0'
okhttp3_version = '3.6.0'
butterknife_version = '8.8.1'
multidex_version = '1.0.2'
junit_version = '4.12'
mockito_core_version = '2.8.47'
mockito_kotlin_version = '1.5.0'
mockwebserver_version = '3.8.0'
assertj_version = '3.8.0'
assertj_android_version = '1.2.0'
robolectric_version = '3.4.2'
jackson_version = '2.9.1'
powermock_version = '1.7.1'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation "com.android.support:support-annotations:$android_support_version"
androidTestImplementation "com.android.support.test:runner:$test_runner_version"
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espresso_core_version"
// kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$rootProject.ext.kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$rootProject.ext.kotlin_version"
// ANKO
implementation "org.jetbrains.anko:anko-sdk25-coroutines:$anko_version"
implementation "org.jetbrains.anko:anko-appcompat-v7-coroutines:$anko_version"
// RXJAVA
implementation "io.reactivex.rxjava2:rxjava:$rxjava_version"
implementation "com.jakewharton.rxbinding2:rxbinding:$rxbinding_version"
// dagger
kapt "com.google.dagger:dagger-compiler:$dagger_version"
kapt "com.google.dagger:dagger-android-processor:$dagger_version"
implementation "com.google.dagger:dagger:$dagger_version"
implementation "com.google.dagger:dagger-android-support:$dagger_version"
compileOnly "org.glassfish:javax.annotation:$javax_annotation_version"
compileOnly "javax.annotation:jsr250-api:$jsr250_api_version"
// MPAndroidChart
implementation "com.github.PhilJay:MPAndroidChart:$MPAndroidChart_version"
// greenDAO
implementation "org.greenrobot:greendao:$greendao_version"
// transitions in older APIs
implementation "com.andkulikov:transitionseverywhere:$transitionseverywhere_version"
// material progress bar
implementation "me.zhanghai.android.materialprogressbar:library:$materialprogressbar_version"
// fitness API
implementation "com.google.android.gms:play-services-fitness:$play_services_fitness_version"
// kotlinx
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinx_coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinx_coroutines_version"
// appcompat
implementation "com.android.support:appcompat-v7:$android_support_version"
implementation "com.android.support:support-v4:$android_support_version"
implementation "com.android.support:design:$android_support_version"
// constraint layout
implementation "com.android.support.constraint:constraint-layout:$constraint_layout_version"
// funktionale
implementation "org.funktionale:funktionale-all:$funktionale_version"
// JODA time
implementation "joda-time:joda-time:$joda_time_version"
// Retrofit 2
implementation "com.squareup.retrofit2:retrofit:$retrofit2_version"
implementation "com.squareup.retrofit2:adapter-rxjava2:$retrofit2_version"
implementation "com.squareup.retrofit2:converter-gson:$retrofit2_version"
implementation "com.squareup.retrofit2:converter-scalars:$retrofit2_version"
// JSONschema
implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version"
implementation "com.fasterxml.jackson.module:jackson-module-jsonSchema:$jackson_version"
implementation 'com.squareup.retrofit2:converter-jackson:2.3.0'
// Okhttp 3
implementation "com.squareup.okhttp3:logging-interceptor:$okhttp3_version"
implementation "com.squareup.okhttp3:okhttp:$okhttp3_version"
// butterknife
testImplementation "com.jakewharton:butterknife:$butterknife_version"
kaptTest "com.jakewharton:butterknife-compiler:$butterknife_version"
// multidex
androidTestImplementation "com.android.support:multidex:$multidex_version"
implementation "com.android.support:multidex:$multidex_version"
// test
testImplementation "org.jetbrains.kotlin:kotlin-reflect:$rootProject.ext.kotlin_version"
testImplementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
testImplementation "junit:junit:$junit_version"
testImplementation "org.mockito:mockito-core:$mockito_core_version"
testImplementation "com.nhaarman:mockito-kotlin:$mockito_kotlin_version"
testImplementation "com.squareup.okhttp3:mockwebserver:$mockwebserver_version"
testImplementation "org.assertj:assertj-core:$assertj_version"
testImplementation "org.robolectric:robolectric:$robolectric_version"
testImplementation "org.robolectric:shadows-multidex:3.4-rc2"
testImplementation "org.powermock:powermock-api-mockito2:$powermock_version"
testImplementation "org.powermock:powermock-module-junit4:$powermock_version"
testImplementation "com.android.support:support-annotations:$android_support_version"
testImplementation "com.squareup.assertj:assertj-android:$assertj_android_version"
}
这些是我在重建项目时得到的警告
:app:transformClassesWithMultidexlistForDebug
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [kotlin-reflect-1.1.51.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [anko-sdk25-coroutines-0.10.1.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [anko-appcompat-v7-coroutines-0.10.1.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [adapter-rxjava2-2.3.0.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [rxjava-2.1.3.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [dagger-2.12.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [MPAndroidChart-v3.0.2.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [greendao-3.2.2.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [kotlinx-coroutines-android-0.16.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [kotlinx-coroutines-core-0.16.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [funktionale-all-1.1.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [joda-time-2.9.9.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [converter-gson-2.3.0.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [converter-scalars-2.3.0.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [converter-jackson-2.3.0.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [retrofit-2.3.0.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [jackson-module-jsonSchema-2.9.1.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/LICENSE] (Duplicate zip entry [jackson-module-jsonSchema-2.9.1.jar:META-INF/LICENSE])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [jackson-databind-2.9.1.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/LICENSE] (Duplicate zip entry [jackson-databind-2.9.1.jar:META-INF/LICENSE])
Warning: can't write resource [META-INF/NOTICE] (Duplicate zip entry [jackson-databind-2.9.1.jar:META-INF/NOTICE])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [jackson-core-2.9.1.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/LICENSE] (Duplicate zip entry [jackson-core-2.9.1.jar:META-INF/LICENSE])
Warning: can't write resource [META-INF/NOTICE] (Duplicate zip entry [jackson-core-2.9.1.jar:META-INF/NOTICE])
Warning: can't write resource [META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.properties] (Duplicate zip entry [jackson-core-2.9.1.jar:META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.properties])
Warning: can't write resource [META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.xml] (Duplicate zip entry [jackson-core-2.9.1.jar:META-INF/maven/com.fasterxml.jackson.core/jackson-core/pom.xml])
Warning: can't write resource [META-INF/services/com.fasterxml.jackson.core.JsonFactory] (Duplicate zip entry [jackson-core-2.9.1.jar:META-INF/services/com.fasterxml.jackson.core.JsonFactory])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [logging-interceptor-3.6.0.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [okhttp-3.8.0.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [anko-appcompat-v7-commons-0.10.1.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [anko-support-v4-commons-0.10.1.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [anko-commons-0.10.1.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [kotlin-stdlib-1.1.51.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [reactive-streams-1.0.1.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [support-annotations-26.1.0.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [jsr305-3.0.1.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [greendao-api-3.2.2.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [constraint-layout-solver-1.0.2.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [gson-2.7.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [jackson-annotations-2.9.0.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/LICENSE] (Duplicate zip entry [jackson-annotations-2.9.0.jar:META-INF/LICENSE])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [validation-api-1.1.0.Final.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [classes.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [common-1.0.0.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [common-1.0.0.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/MANIFEST.MF] (Duplicate zip entry [okio-1.13.0.jar:META-INF/MANIFEST.MF])
Warning: can't write resource [META-INF/maven/com.squareup.okio/okio/pom.xml] (Duplicate zip entry [okio-1.13.0.jar:META-INF/maven/com.squareup.okio/okio/pom.xml])
Warning: can't write resource [META-INF/maven/com.squareup.okio/okio/pom.properties] (Duplicate zip entry [okio-1.13.0.jar:META-INF/maven/com.squareup.okio/okio/pom.properties])
我知道这些只是警告,可能对应用程序没有任何伤害,但是 如何告诉gradle排除这些文件?
答案 0 :(得分:1)
在vector <int>v;
vector <int>:: iterator it,it1;
it=v.begin();
it1=v.end();
v.insert(it,12); // in this line doesn't matter what i write it or it1
it=v.begin(); it1=v.end(); // here *it=12, also it is first element and it1 = last element + 1
v.insert(it1,15); // if i write it instead of it1, then v contains 15 12
it=v.begin(); it1=v.end();
cout<<*(it+1); // this line outputs 15;
build.gradle
答案 1 :(得分:0)
更新到最新的Android Studio版本(3.0 RC1)后问题消失了。
答案 2 :(得分:0)
我知道这不是你的答案,但也许可以帮助其他人:
升级到Android Studio 3.0后,我的应用程序正在构建以下错误:
compile 'com.jakewharton:butterknife:8.8.1'
经过一些浪费时间后,我找到了解决方案:
compile ('com.jakewharton:butterknife:8.8.1'){
exclude module: 'support-compat'
}