Ionic Android build会抛出警告 [英] Ionic Android build throws warnings

查看:194
本文介绍了Ionic Android build会抛出警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我使用Ionic构建项目时,它会给出1000条警告。我试过很多事情,在 proguard-rules.pro 的变化,但没有一个似乎是工作。我不知道如何删除这些警告。其中一些在下面。

Whenever I build my project using Ionic it gives me 1000 of warnings. I have tried many things, changes in the proguard-rules.pro, but none of them seems to be working. I am not sure how to remove those warnings. Some of them are below.

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'如下

And my 'progaurd-rules.pro' as follows

-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列表。

When I build on Android Studio, I dont get warnings. But on terminal, 'ionic android build' I get warnings, that too only on first time after 'ionic state reset'. Those warnings are because of list of Notes displaying.

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图书馆。请帮助我。

For the first time, there are many getting updated, from second time, all are up-to-date so I dont get warnings. This is detailed analysis on the issue. Also I forgot to mention that these are from AAR libraries that I use in my ionic project. Please help me on this.

推荐答案

要添加到答案,还需要proguard设置。

To add up to the answer, proguard setting too is still required.

-dontnote 选项设置应该有助于抑制警告。有关dontnote选项的详情,请查看官方文档

-dontnote option setting in proguard should help suppress the warnings. For more info on dontnote option, please check out official doc.

这篇关于Ionic Android build会抛出警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆