Friday, August 26, 2016

node.js - Gradle "... occurred starting process 'command 'npm''" on Mac

When  you use the react-native  build release APK;

if you meet this question:

node.js - Gradle "... occurred starting process 'command 'npm''" on Mac

you must use this command in the Root Project

react-native start      or   npm start

If the terminal always show:  the error infos:

you must in the android/dir  use this  command:
./gradlew --stop

无法查询北京公积金的余额?

注意:

公积金查询数据每周三、周五更新(16:00——21:00)

怎么说呢?

垃圾!

Thursday, August 25, 2016

Notification using setFullScreenIntent() for BigTextStyle opening Activity automatically


昨天,遇到一个很头疼的问题。收到服务器的推送之后,APP重新启动了。但是,测试里面还不报错。

找了半天,找到问题的根源是因为 Notifacation 的问题:

用了 serFullScreenIntent();

这个方法在Android6.0 以下没有任何的问题。 但是在Android 6.0 中的,小米的手机上面,至于其他的手机,我只测试了三星没有问题。至于其他的手机,没有测过。

所以这个地方昨个版本判断就好了:
if(Build.VERSION.SDK_INT < 23){
    //Android 6.0 一下的版本没什么问题。 可以正常弹窗    mBuilder.setFullScreenIntent(pendingIntent, true);}else{
    //Android 6.0 小米貌似做了深度的定制,然后会重新启动APP. 三星的没有问题, 其他的机型不详}


待优化:   这个地方,这样做有点暴力。应该是,那个版本有问题就解决那个,我现在是把Android6.0 一棒子全部打死了。你可以尝试自己写一个工具类: 判定用户的手机是不是小米的手机, 如果是小米的手机,就不设置serFullScreenIntent();

解决问题很简单,但是,时间基本上都花在了寻找问题上。定位问题上面了!


很多的时候,都是这个样子。解决起来很快,但是定位问题比较的麻烦!

Wednesday, August 24, 2016

android how to resolve compile release APK, Proguard error: "Warning:"


  今天在打正式包的时候,突然报错了。 让我有点懵逼了。然后, 打正式包的时候报错了。

解决方案:
就是在代码混淆的时候,去掉这些 waring:


例如 :
# android 6.0 SDK 23 start-dontwarn com.nhaarman.listviewanimations.** { *; }
-dontwarn com.solok.datetime.** { *; }
-dontwarn com.tencent.connect.avatar.** { *; }
-dontwarn com.viewpagerindicator.LinePageIndicator.** { *; }
-dontwarn uk.co.senab.photoview.** { *; }



# android 6.0 SDK 23 end


OK 你看一下你的报错的信息里面,需要注释的 warning 一一添加就可以了!

这里解析一下:
因为,我把编译的版本提高了23,所以,就会出现一些工具方法过时的问题。因为, Android 6.0 废弃了很多没有用的方法。所以,导致了我们在适配6.0 的时候,很多依赖的第三方可能还没有适配6.0 ,所以出现了这么多的warning!

其实,很多的第三方的一些类,我们根本没有用到。这里直接在混淆文件里面直接 使用 dontwarn  就可以了,但是,如果自己的写的依赖库, 可能用到了 过时的方法。这个时候,我们就要手动的去修改依赖库的代码了!


这样说吧:
--dontwarn  只是不报错,只是治标不治本
修改原生代码,  根治这个问题


error info:

Initializing...
Note: the configuration refers to the unknown class 'com.google.vending.licensing.ILicensingService'
Note: the configuration refers to the unknown class 'com.android.vending.licensing.ILicensingService'
Note: the configuration refers to the unknown class 'com.facebook.react.uimanager.UIProp'
Note: the configuration refers to the unknown class 'sun.misc.Unsafe'
Note: the configuration refers to the unknown class 'com.eallcn.rentagent.orm.SugarRecord'
      Maybe you meant the fully qualified name 'com.orm.SugarRecord'?
Note: the configuration refers to the unknown class 'com.eallcn.chow.entity.RepTrend'
      Maybe you meant the fully qualified name 'com.eallcn.rentagent.entity.common.RepTrend'?
Note: the configuration refers to the unknown class 'com.nhaarman.listviewanimations.itemmanipulation.dragdrop.DynamicListViewTestActivity'
Note: the configuration refers to the unknown class 'com.nhaarman.listviewanimations.itemmanipulation.swipedismiss.SwipeTouchListenerTestActivity'
Note: the configuration refers to the unknown class 'se.emilsjolander.stickylistheaders.StickyListHeadersListView'
      Maybe you meant the fully qualified name 'com.eallcn.rentagent.widget.sticky.StickyListHeadersListView'?
Warning: com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator: can't find superclass or interface se.emilsjolander.stickylistheaders.StickyListHeadersAdapter
Warning: com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersAdapter
Warning: com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersAdapter
Warning: com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersAdapter
Warning: com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersAdapter
Warning: com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.appearance.StickyListHeadersAdapterDecorator: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.nhaarman.listviewanimations.util.StickyListHeadersListViewWrapper: can't find referenced class se.emilsjolander.stickylistheaders.StickyListHeadersListView
Warning: com.solok.datetime.WheelImageView: can't find referenced method 'float ceil(float)' in library class android.util.FloatMath
Warning: com.solok.datetime.WheelView: can't find referenced method 'float ceil(float)' in library class android.util.FloatMath
Warning: com.tencent.connect.avatar.c: can't find referenced method 'float sqrt(float)' in library class android.util.FloatMath
Warning: com.viewpagerindicator.LinePageIndicator: can't find referenced method 'float ceil(float)' in library class android.util.FloatMath
Warning: uk.co.senab.photoview.PhotoViewAttacher: can't find referenced method 'float sqrt(float)' in library class android.util.FloatMath
Warning: uk.co.senab.photoview.gestures.CupcakeGestureDetector: can't find referenced method 'float sqrt(float)' in library class android.util.FloatMath
Note: android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21: can't find dynamically referenced class android.service.media.IMediaBrowserServiceCallbacks
Note: android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21: can't find dynamically referenced class android.content.pm.ParceledListSlice
Note: android.support.v4.media.IMediaBrowserServiceCallbacksAdapterApi21$Stub: can't find dynamically referenced class android.service.media.IMediaBrowserServiceCallbacks$Stub
Note: android.support.v4.media.ParceledListSliceAdapterApi21: can't find dynamically referenced class android.content.pm.ParceledListSlice
Note: android.support.v4.text.ICUCompatApi23: can't find dynamically referenced class libcore.icu.ICU
Note: android.support.v4.text.ICUCompatIcs: can't find dynamically referenced class libcore.icu.ICU
Note: android.support.v7.widget.DrawableUtils: can't find dynamically referenced class android.graphics.Insets
Note: com.alibaba.fastjson.parser.ParserConfig: can't find dynamically referenced class java.awt.Point
Note: com.alibaba.fastjson.parser.ParserConfig: can't find dynamically referenced class java.awt.Font
Note: com.alibaba.fastjson.parser.ParserConfig: can't find dynamically referenced class java.awt.Rectangle
Note: com.alibaba.fastjson.parser.ParserConfig: can't find dynamically referenced class java.awt.Color
Note: com.alibaba.fastjson.serializer.SerializeConfig: can't find dynamically referenced class java.awt.Color
Note: com.alibaba.fastjson.serializer.SerializeConfig: can't find dynamically referenced class java.awt.Font
Note: com.alibaba.fastjson.serializer.SerializeConfig: can't find dynamically referenced class java.awt.Point
Note: com.alibaba.fastjson.serializer.SerializeConfig: can't find dynamically referenced class java.awt.Rectangle
Note: com.baidu.location.b.d$a: can't find dynamically referenced class android.os.SystemProperties
Note: com.baidu.location.b.e: can't find dynamically referenced class android.os.storage.StorageVolume
Note: com.baidu.platform.comapi.util.e: can't find dynamically referenced class android.os.storage.StorageVolume
Note: com.facebook.common.webp.WebpSupportStatus: can't find dynamically referenced class com.facebook.webpsupport.WebpBitmapFactoryImpl
Note: com.facebook.imagepipeline.animated.factory.AnimatedFactoryProvider: can't find dynamically referenced class com.facebook.imagepipeline.animated.factory.AnimatedFactoryImplSupport
Note: com.facebook.imagepipeline.animated.factory.AnimatedFactoryProvider: can't find dynamically referenced class com.facebook.imagepipeline.animated.factory.AnimatedFactoryImpl
Note: com.facebook.imagepipeline.nativecode.WebpTranscoderFactory: can't find dynamically referenced class com.facebook.imagepipeline.nativecode.WebpTranscoderImpl
Note: com.google.common.util.concurrent.MoreExecutors: can't find dynamically referenced class com.google.appengine.api.ThreadManager
Note: com.google.common.util.concurrent.MoreExecutors: can't find dynamically referenced class com.google.apphosting.api.ApiProxy
Note: com.google.gson.internal.UnsafeAllocator: can't find dynamically referenced class sun.misc.Unsafe
Note: com.hyphenate.chat.EMPushHelper: can't find dynamically referenced class com.google.android.gms.common.GooglePlayServicesUtil
Note: com.hyphenate.chat.EMPushHelper: can't find dynamically referenced class com.xiaomi.mipush.sdk.MiPushClient
Note: com.parse.ParseHttpClient: can't find dynamically referenced class com.squareup.okhttp.OkHttpClient
Note: com.sina.weibo.sdk.utils.AidTask: can't find dynamically referenced class android.os.SystemProperties
Note: com.tencent.mm.sdk.platformtools.NetStatusUtil: can't find dynamically referenced class android.app.ActivityManagerNative
Note: com.tencent.mm.sdk.platformtools.NetStatusUtil: can't find dynamically referenced class android.net.NetworkPolicyManager
Note: de.devland.esperandro.Esperandro: can't find dynamically referenced class de.devland.esperandro.serialization.GsonSerializer
Note: okhttp3.internal.platform.AndroidPlatform: can't find dynamically referenced class com.android.org.conscrypt.SSLParametersImpl
Note: okhttp3.internal.platform.AndroidPlatform: can't find dynamically referenced class org.apache.harmony.xnet.provider.jsse.SSLParametersImpl
Note: okhttp3.internal.platform.Platform: can't find dynamically referenced class sun.security.ssl.SSLContextImpl
Note: org.jivesoftware.smack.XMPPConnection: can't find dynamically referenced class sun.security.pkcs11.SunPKCS11
Note: org.jivesoftware.smack.compression.JzlibInputOutputStream: can't find dynamically referenced class com.jcraft.jzlib.ZOutputStream
Note: org.jivesoftware.smack.compression.JzlibInputOutputStream: can't find dynamically referenced class com.jcraft.jzlib.ZInputStream
Note: there were 9 references to unknown classes.
      You should check your configuration for typos.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#unknownclass)
Note: there were 38 unresolved dynamic references to classes or interfaces.
      You should check if you need to specify additional program jars.
      (http://proguard.sourceforge.net/manual/troubleshooting.html#dynamicalclass)
Warning: there were 21 unresolved references to classes or interfaces.
         You may need to add missing library jars or update their versions.
         If your code works fine without the missing classes, you can suppress
         the warnings with '-dontwarn' options.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 6 unresolved references to library class members.
         You probably need to update the library versions.
         Alternatively, you may have to specify the option
         '-dontskipnonpubliclibraryclassmembers'.
         (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)
Warning: Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForMlwRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesAndResourcesWithProguardForMlwRelease'.
> java.io.IOException: Please correct the above warnings first.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED


Thursday, August 18, 2016

react native 的原理解析

最近,学习了React Native ,开始的时候,真的是一头雾水的感觉。丈二和尚摸不到头脑,今天总结一下,这几天学到的东西。

我觉的,react-native 

实现目的: 热更新

1  这里Node.js 作为服务,开启一个本地的Socket流, 监听本地的8081 端口。 当你使用 react-native start 或者  npm start.  他就像是一个依赖仓库一样,她不会主动的更新,当你不发起请求的时候,她是不会更新的。 尽管,你本地的 js 代码已经更新了。 
奥, 原理,Node.js  把你本地写的js 文件,当做组件(相当于Android 里面jcenter 的依赖库),当你用户出发更新到时候, node 会自动的更新组件库。


Android “Could not get BatchedBridge, make sure your bundle is packaged properly”

今天,刚把项目集成到 React-Native  里面,安装的时候没什么问题。但是,打开的时候,出现了问题,
如图:




如何解决:
参考:


针对Mac:
第一步: 
打开你的terminal
进入你的ReactNative 初始化的根目录里面。
然后, 运行下面这行命令



curl "http://localhost:8081/index.android.bundle?platform=android" -o "android/app/src/main/assets/index.android.bundle"

这行命令是把你本地的 jsBundle 下载到你的 android/app/src/main/assets/index.android.bundle

如果没有 assets目录的自己新建一个就可以了!

当你再次打包的时候,就把你的本地的Js打包进去了。这个时候,你就可以进行测试了!


本人测试没什么问题!