Saturday, December 23, 2017

Install apk application using adb via usb

Connect your device via USB. Makse sure your device has Developer options enable, and USB debugging checked.

Run adb in cmd, for example in Mito A150:
>adb devices
List of devices attached
J32V2ML17X026640        device

>adb -s J32V2ML17X026640 install d:\BT-POSPrinter.apk
d:\BT-POSPrinter.apk: 1 file pushed. 1.7 MB/s (259008 bytes in 0.148s)
        pkg: /data/local/tmp/BT-POSPrinter.apk
Success


References:
  • https://developer.android.com/studio/command-line/adb.html 

Debian Stretch: restrict SMTPD in Postfix

We use Sorbs.net and SpamCop.net service for restrict our SMTPD in postfix.

Add/edit /etc/postfix/main.cf:
...
smtpd_recipient_restrictions = reject_invalid_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unauth_pipelining, permit_mynetworks, reject_unauth_destination, reject_rbl_client bl.spamcop.net, reject_rbl_client dnsbl.sorbs.net, permit_sasl_authenticated
...

Restart your postfix
# service postfix restart

Watch your postfix status
# service postfix status

References:
  • http://www.sorbs.net/mailsystems/postfix-2.3.shtml 
  • https://www.spamcop.net/fom-serve/cache/349.html

Monday, December 11, 2017

Android Studio 3: making gradle build a bit faster

Enable offline mode

If you are on a slow network connection, your build times may suffer when Gradle attempts to use network resources to resolve dependencies. You can tell Gradle to avoid using network resources by using only the artifacts that it has cached locally.
To use Gradle offline when building with Android Studio, proceed as follows:
  1. Open the Preferences window by clicking File > Settings (on Mac, Android Studio > Preferences).
  2. In the left pane, click Build, Execution, Deployment > Gradle.
  3. Check the Offline work checkbox.
  4. Click Apply or OK.

Enable configuration on demand

For Gradle to know exactly how to build your app, the build system configures all modules in your project, and their dependencies, before every build (even if you are building and testing only a single module). This slows down the build process for large multi-module projects. To tell Gradle to configure only the modules that you want to build, enable configuration on demand by following these steps:
  1. Open the Preferences window by clicking File > Settings (on Mac, Android Studio > Preferences).
  2. In the left pane, click Build, Execution, Deployment > Compiler.
  3. Check the Configure on demand checkbox.
  4. Click Apply or OK


For more option follow this rule https://developer.android.com/studio/build/optimize-your-build.html


References:

  • https://developer.android.com/studio/build/optimize-your-build.html 

Sunday, December 10, 2017

Genymotion and Virtualbox not working properly after windows 10 update Build 16299

After windows 10 automatic update into cersion 10.0.16299 Build 16299, Genymotion won't start and Virtualbox doesnot working properly.

Symptom:
  1. Genymotion (Version 2.11), will stop during loading plugin and generate genymotion-log.zip log file under folder c:\user\[username]\genymotion-log.zip.
  2. Virtualbox (Version 5.2.2 r119230) -> Global Tools -> Host Network Manager, always fail to create VirtualBox Host-Only Ethernet Adapter. There is no any VirtualBox Host-Only Ethernet Adapter (empty)
IMO, the cause of this problem, Virtualbox Network Driver does not configure properly after windows update.

Solution:
Uninstall your Virtualbox, restart your windows and reinstall your Virtualbox.

Note your existing virtual device will be safe (untouch).




Thursday, December 7, 2017

Android Studio 3 on Debian Stretch: Fail to run AVD

Symptoms:
  1. Emulator: libGL error: unable to load driver: r600_dri.so
  2. Emulator: libGL error: driver pointer missing
  3. ...etc

To solve this issue:
  1. 1. backup your libstdc++ included in android sdk.
    ~/android-sdk-linux/emulator/lib64/libstdc++/libstdc++.so.6
    $ mv libstdc++.so.6 libstdc++.so.6.bak
  2. make link libstdc++.so.6 from debian stretch
    $ ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6
References:
  1. https://android.stackexchange.com/questions/145437/reinstall-avd-on-ubuntu-16-04
  2. https://stackoverflow.com/questions/36189393/android-studio-avd-error-launching