Ionic Android build会发出警告

时间:2016-07-08 05:29:34

标签: android cordova ionic-framework

每当我使用Ionic构建我的项目时,它会给我1000个警告。我在proguard-rules.pro中尝试过很多改动,但似乎都没有。我不知道如何删除这些警告。其中一些在下面。

Maybe this is program method 'org.xwalk.core.internal.InMemorySharedPreferences$InMemoryEditor { void apply(); }'
Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'icon' dynamically
      Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { int icon; }'
      Maybe this is program field 'android.support.v7.appcompat.R$attr { int icon; }'
      Maybe this is program field 'android.support.v7.appcompat.R$id { int icon; }'
      Maybe this is program field 'com.digits.sdk.android.R$attr { int icon; }'
      Maybe this is program field 'com.digits.sdk.android.R$id { int icon; }'
      Maybe this is program field 'com.facebook.android.R$attr { int icon; }'
      Maybe this is program field 'com.facebook.android.R$id { int icon; }'
      Maybe this is program field 'com.twitter.sdk.android.R$attr { int icon; }'
      Maybe this is program field 'com.twitter.sdk.android.R$id { int icon; }'
      Maybe this is program field 'dk.nodes.ncore.R$attr { int icon; }'
      Maybe this is program field 'dk.nodes.ncore.R$id { int icon; }'
      Maybe this is program field 'io.fabric.sdk.android.services.settings.AppRequestData { io.fabric.sdk.android.services.settings.IconRequest icon; }'
      Maybe this is program field 'io.fabric.sdk.android.services.settings.AppSettingsData { io.fabric.sdk.android.services.settings.AppIconSettingsData icon; }'
Note: android.support.v4.app.NotificationCompatJellybean accesses a declared field 'title' dynamically
      Maybe this is program field 'android.support.v4.app.NotificationCompat$Action { java.lang.CharSequence title; }'
      Maybe this is program field 'android.support.v7.appcompat.R$attr { int title; }'
      Maybe this is program field 'android.support.v7.appcompat.R$id { int title; }'
      Maybe this is program field 'com.digits.sdk.android.R$attr { int title; }'
      Maybe this is program field 'com.digits.sdk.android.R$id { int title; }'
      Maybe this is program method 'com.google.android.gms.internal.zzso { com.google.android.gms.internal.zzsu clone(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzso { java.lang.Object clone(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzsq { java.lang.Object clone(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzsr { java.lang.Object clone(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzsu { com.google.android.gms.internal.zzsu clone(); }'
      Maybe this is program method 'com.google.android.gms.internal.zzsu { java.lang.Object clone(); }'
      Maybe this is program method 'com.google.gson.internal.Excluder { com.google.gson.internal.Excluder clone(); }'
      Maybe this is program method 'com.google.gson.internal.Excluder { java.lang.Object clone(); }'
      Maybe this is program method 'com.google.protobuf.AbstractMessage$Builder { com.google.protobuf.AbstractMessage$Builder clone(); }'
      Maybe this is program method 'com.google.protobuf.AbstractMessage$Builder { com.google.protobuf.AbstractMessageLite$Builder clone(); }'
      Maybe this is program method 'com.google.protobuf.AbstractMessage$Builder { com.google.protobuf.MessageLite$Builder clone(); }'
      Maybe this is program method 'com.google.protobuf.AbstractMessage$Builder { java.lang.Object clone(); }'
      Maybe this is program method 'com.google.protobuf.AbstractMessage$Builder { com.google.protobuf.Message$Builder clone(); }'

我的'progaurd-rules.pro'如下

-keepattributes InnerClasses
-keepattributes Signature
-keepattributes Exceptions
-verbose

-dontoptimize
-dontpreverify

-dontnote **

-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepattributes EnclosingMethod
-keepattributes *Annotation*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
-keep public class * extends android.support.v4.app.Fragment
-keep public class * extends android.app.Fragment
-keep public class com.google.** {*; }
-keep public class com.facebook.** {*; }

-ignorewarnings

-dontwarn android.support.v7.**
-keep class android.support.v7.internal.** { *; }
-keep interface android.support.v7.internal.** { *; }
-keep class android.support.v7.** { *; }

-dontwarn android.support.v7.appcompat.** {*;}
-dontwarn com.squareup.okhttp.**
-keep interface android.support.v7.appcompat.** { *; }
-keep class android.support.v7.appcompat.** { *; }

-keep class com.facebook.** {
   *;
}

-dontwarn org.apache.commons.lang3.time.**
-dontwarn dk.nodes.widgets.buttons.**
-dontwarn net.hockeyapp.android.tasks.**

-dontobfuscate
-dontpreverify

-dontnote android.support.v4.app.NotificationCompatJellybean
-dontwarn android.support.v4.app.NotificationCompatJellybean

-dontnote org.apache.commons.lang3.ObjectUtils
-dontwarn org.apache.commons.lang3.ObjectUtils

-dontnote com.google.protobuf.Descriptors$FileDescriptor
-dontwarn com.google.protobuf.Descriptors$FileDescriptor

-dontwarn class * extends com.google.protobuf.GeneratedMessageLite.** { *; }
-dontwarn interface * extends com.google.protobuf.GeneratedMessageLite.** { *; }
-dontnote com.google.protobuf.**
-dontnote com.google.android.**

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembernames class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

 -keepclassmembers public class * extends android.view.View {
  void set*(***);
  *** get*();
 }

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

-keepclassmembers class **.R$* {
  public static <fields>;
  <fields>;
}

-libraryjars libs
#-injars libs/AudienceNetwork.jar
#-injars libs/google-api-client-1.18.0-rc.jar
#-injars libs/google-api-client-android-1.18.0-rc.jar
#-injars libs/google-http-client-android-1.18.0-rc.jar


 # The official support library.
-keep class android.support.v4.** { *; }
-keepclassmembers class android.support.v4.** {
    *;
 }
-keep interface android.support.v4.** { *; }
-keep class android.support.v7.** { *; }
-keepclassmembers class android.support.v7.** {
    *;
 }
-keep interface android.support.v7.** { *; }

# Library JARs.
-keep class com.facebook.** {
   *;
}
-keepclassmembers class com.facebook.** {
    *;
 }

当我在Android Studio上构建时,我不会收到警告。但是在终端上,“离子机器人构建”我得到警告,这也只是在“离子状态重置”之后的第一次。这些警告是由于显示的Notes列表。

Reading library jar [/Users/neelavijayakumar/Library/Android/sdk/build-tools/23.0.2/lib/shrinkedAndroid.jar]
Note: android.support.v4.view.ViewPager calls 'Class.getAnnotation'
Note: com.facebook.model.GraphObject$Factory calls 'Method.getAnnotation'
Note: com.facebook.model.GraphObject$Factory$GraphObjectProxy calls 'Method.getAnnotation'
Note: com.google.ads.mediation.MediationServerParameters calls 'Field.getAnnotation'
Note: com.google.android.gms.internal.zzamp calls 'Field.getAnnotation'
Note: com.google.android.gms.internal.zzant calls 'Class.getAnnotation'
Note: com.google.android.gms.internal.zzant calls 'Field.getAnnotation'
Note: com.google.android.gms.internal.zzaoe calls 'Class.getAnnotation'
Note: com.google.android.gms.internal.zzaoj calls 'Field.getAnnotation'
Note: com.google.android.gms.internal.zzaon$zza calls 'Field.getAnnotation'
Note: com.google.gson.FieldAttributes calls 'Field.getAnnotation'
Note: com.google.gson.FieldAttributes calls 'Field.getAnnotations'
Note: com.google.gson.internal.Excluder calls 'Field.getAnnotation'
Note: com.google.gson.internal.Excluder calls 'Class.getAnnotation'
Note: com.google.gson.internal.bind.JsonAdapterAnnotationTypeAdapterFactory calls 'Class.getAnnotation'
Note: com.google.gson.internal.bind.ReflectiveTypeAdapterFactory calls 'Field.getAnnotation'
Note: com.google.gson.internal.bind.TypeAdapters$EnumTypeAdapter calls 'Field.getAnnotation'
Note: com.pushwoosh.internal.request.RequestManager$1 calls 'Class.getAnnotation'
Note: io.fabric.sdk.android.Fabric calls 'Class.getAnnotation'
Note: io.fabric.sdk.android.Kit calls 'Class.getAnnotation'
Note: org.xwalk.core.extension.JsStubGenerator calls 'Method.getParameterAnnotations'
Note: retrofit.RestMethodInfo calls 'Method.getAnnotations'
Note: retrofit.RestMethodInfo calls 'Class.getAnnotations'
Note: retrofit.RestMethodInfo calls 'Method.getParameterAnnotations'
Note: acidhax.cordova.chromecast.Chromecast calls 'Method.getGenericParameterTypes'
Note: android.support.v4.app.NotificationCompatJellybean calls 'Field.getType'
Note: com.digits.sdk.android.ActivityClassManagerFactory$ThemeAttributes calls 'Field.getType'
Note: com.digits.sdk.android.ThemeUtils calls 'Field.getType'
Note: com.facebook.model.GraphObject$Factory$GraphObjectProxy calls 'Method.getGenericReturnType'
Note: com.google.android.gms.internal.zzanr calls 'Class.getGenericInterfaces'
Note: com.google.android.gms.internal.zzanr calls 'Class.getGenericSuperclass'
Note: com.google.android.gms.internal.zzanr calls 'Class.getTypeParameters'
Note: com.google.android.gms.internal.zzant calls 'Field.getType'
Note: com.google.android.gms.internal.zzaoj calls 'Class.getGenericSuperclass'
Note: com.google.android.gms.internal.zzaoj calls 'Field.getGenericType'
Note: com.google.android.gms.internal.zzaoj calls 'Field.getType'
Note: com.google.android.gms.internal.zzaoo calls 'Class.getGenericSuperclass'
Note: com.google.android.gms.internal.zzapd calls 'Field.getType'
Note: com.google.gson.FieldAttributes calls 'Field.getGenericType'
Note: com.google.gson.FieldAttributes calls 'Field.getType'

有史以来第一次有很多更新,从第二次开始,所有都是最新的,所以我没有得到警告。这是对该问题的详细分析。另外我忘了提到这些来自我在离子项目中使用的AAR库。请帮帮我。

2 个答案:

答案 0 :(得分:1)

修正了所有警告,我相信我之前已经尝试过,但现在可以了。

将离子上的Gradle版本更改为&#34; 2.0.0&#34; 并且gradle包装器分发URL为&#34; http \://services.gradle.org/distributions/gradle-2.10-all.zip"

它只是有效..

答案 1 :(得分:1)

要添加答案,还需要进行预设设置。

proguard中的

-dontnote选项设置应该有助于抑制警告。有关dontnote选项的更多信息,请查看official doc