gpt4 book ai didi

android - 发布构建 apk 文件

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:47:14 24 4
gpt4 key购买 nike

我正在使用一个应用程序,我在我的应用程序的 build.gradle 文件中启用了 runProguard true。当我去构建签名的 apk 时,我收到警告并且构建过程失败。

日志文件:

Warning:com.google.common.base.Absent: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Ascii: can't find referenced class javax.annotation.CheckReturnValue
Warning:com.google.common.base.CaseFormat$StringConverter: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.CharMatcher: can't find referenced class javax.annotation.CheckReturnValue
Warning:com.google.common.base.Converter: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Converter$ConverterComposition: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Converter$FunctionBasedConverter: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Converter$ReverseConverter: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Defaults: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Enums$StringConverter: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Equivalence: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Equivalence$EquivalentToPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Equivalence$Wrapper: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.FinalizableReferenceQueue$FinalizerLoader: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Function: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.FunctionalEquivalence: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions$ConstantFunction: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions$ForMapWithDefault: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions$FunctionComposition: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions$FunctionForMapNoDefault: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions$IdentityFunction: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions$PredicateFunction: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Functions$SupplierFunction: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Joiner: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Joiner: can't find referenced class javax.annotation.CheckReturnValue
Warning:com.google.common.base.Joiner$1: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Joiner$MapJoiner: can't find referenced class javax.annotation.CheckReturnValue
Warning:com.google.common.base.MoreObjects: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.MoreObjects$ToStringHelper: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Objects: can't find referenced class javax.annotation.CheckReturnValue
Warning:com.google.common.base.Objects: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Objects$ToStringHelper: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Optional: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.PairwiseEquivalence: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Preconditions: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$AndPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$AssignableFromPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$CompositionPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$ContainsPatternPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$InPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$InstanceOfPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$IsEqualToPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$NotPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$ObjectPredicate$1: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$ObjectPredicate$2: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$ObjectPredicate$3: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$ObjectPredicate$4: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Predicates$OrPredicate: can't find referenced class javax.annotation.Nullable
Warning:com.google.common.base.Present: can't find referenced class javax.annotation.Nullable

构建.gradle

apply plugin: 'com.android.application'

android {

signingConfigs {

}
compileSdkVersion 21

buildToolsVersion '20.0.0'

defaultConfig {

minSdkVersion 15

targetSdkVersion 21

versionCode 1

versionName '1.0'

}
buildTypes {

release {

runProguard true

proguardFiles getDefaultProguardFile('proguard-android.txt'),

'proguard-rules.pro'
}

}
productFlavors {

}
packagingOptions {

exclude 'META-INF/LICENSE.txt'

exclude 'META-INF/NOTICE.txt'
}

}

dependencies {

compile fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.google.guava:guava:18.0'

compile 'com.google.code.gson:gson:2.3'

compile 'com.microsoft.azure:azure-mobile-services-android-sdk:2.0.2-beta+'

compile (group: 'com.microsoft.azure', name: 'azure-notifications-handler', version: '1.0.1', ext: 'jar')

compile project(':library')

compile project(':StyleableDateTimePicker-master')

compile 'com.facebook.android:facebook-android-sdk:3.23.+'

compile 'com.android.support:support-v4:22.0.0+'

compile 'com.android.support:appcompat-v7:22.0.0'

compile 'com.google.android.gms:play-services:6.5.87'

compile 'com.github.navasmdc:MaterialDesign:1.+@aar'

compile 'com.android.support:recyclerview-v7:21.0.0'

compile 'com.android.support:cardview-v7:21.0.+'

compile 'com.melnykov:floatingactionbutton:1.1.0'

compile 'com.ToxicBakery.viewpager.transforms:view-pager-transforms:1.1.0@aar'

compile 'de.hdodenhof:circleimageview:1.2.2'

compile 'com.github.alamkanak:android-week-view:1.2.1'

compile('ch.acra:acra:4.5.0') {

exclude group: 'org.json'
}

compile 'com.github.machinarius:preferencefragment:0.1.1'

}

最佳答案

我想我终于想通了!

梯度依赖:

dependencies {
...
compile 'com.google.guava:guava:18.0'
/* Required for using guava with proguard */
compile 'javax.annotation:jsr250-api:1.0'
}

添加到我的混淆器配置中:

##-------------Begin Settings For Guava ------------------------------------------------------------
#https://github.com/krschultz/android-proguard-snippets/blob/master/libraries/proguard-guava.pro
# Configuration for Guava
#
# disagrees with instructions provided by Guava project: https://code.google.com/p/guava-libraries/wiki/UsingProGuardWithGuava
#
# works if you add the following line to the Gradle dependencies
#
# provided 'javax.annotation:jsr250-api:1.0'
-keep class com.google.common.io.Resources {
public static <methods>;
}
-keep class com.google.common.collect.Lists {
public static ** reverse(**);
}
-keep class com.google.common.base.Charsets {
public static <fields>;
}

-keep class com.google.common.base.Joiner {
public static Joiner on(String);
public ** join(...);
}

-keep class com.google.common.collect.MapMakerInternalMap$ReferenceEntry
-keep class com.google.common.cache.LocalCache$ReferenceEntry

-dontwarn sun.misc.Unsafe
-dontwarn javax.annotation.**

##-------------End Settings For Guava --------------------------------------------------------------

对我有帮助的链接

关于android - 发布构建 apk 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29343233/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com