Kategorien
Android

Android Gradle Plugin 2.2.0-alpha3 is missing zipalign

I have setup a Jenkins that automatically uploads nightly APKs to the Play Store. Starting some days ago, the upload to the Play always failed with this: Upload failed: APK is not zip aligned.

So I investigated a bit found that one of the changes that I did the days these issues started was to update the Gradle plugin to 2.2.0-alpha3. Doing a quick Google search showed that everybody is having this issue.

Gradle plugin 2.2.0-alpha3 is somehow missing the zipalign task and will create APKs that are NOT zip aligned! I also tested to manually sign the APK afterwards, which also fails…

So for now, the only solution would be to revert back to 2.2.0-alpha2 of the Gradle plugin. Which also forces you to revert back to Android Studio 2.2 Preview 2 since Preview 3 will not compile your project when you don’t use plugin version 2.2.0-alpha3… But how do we do that?

Yeah, you have to do a fresh installation of Android Studio 2.2 Preview 2 and perform the updates until you are at Preview 2 and then stop, don’t install the Preview 3 update and wait for Preview 4.

[1] https://code.google.com/p/android/issues/detail?id=212591
[
2] http://tools.android.com/download/studio/builds/2-2-preview-2

Kategorien
Android

Configuration for Gitlab CI Android projects

Hey everyone,

I just recently wanted to give Gitlab CI a try. It is the CI part of the Gitlab hosting solution. They just recently announced that you can use their shared runners that they are now running on DigitalOcean’s servers for free!

So I currently have an Android project that I want to have built on one their free shared runners. I wasn’t able to find a straight forward solution for a .gitlab-ci.yml  file that works for Android projects.

So, this is what I now successfully use for building my Android project on Gitlab CI’s free shared runners:

image: java:openjdk-8-jdk

before_script:
  - apt-get --quiet update --yes
  - apt-get --quiet install --yes wget tar unzip lib32stdc++6 lib32z1
  - wget --quiet --output-document=android-sdk.tgz https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
  - tar --extract --gzip --file=android-sdk.tgz
  - echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter android-23
  - echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter platform-tools
  - echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter build-tools-23.0.2
  - echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-android-m2repository
  - echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-google_play_services
  - echo y | android-sdk-linux/tools/android --silent update sdk --no-ui --all --filter extra-google-m2repository
  - export ANDROID_HOME=$PWD/android-sdk-linux
  - chmod u+x ./gradlew

build:
  script:
    - ./gradlew assemble lint
  artifacts:
    paths:
    - app/build/outputs/

Let’s analyse it:

At first we have image: java:openjdk-8-jdk . This instructs Gitlab CI to load a Docker image with OpenJDK 8 configured. This is because I make use of RetroLambda -> we need Java 8.

Next we update the system via apt-get and install some dependecies.

Next we download and unzip the current Android SDK.

Once unzipped, we can use the Android SDK Manager to install all of our needed Android SDK components.

Next we need to set the ANDROID_HOME environment variable.

Finally, we need to make the Gradle Wrapper script executable.

Then in the script: block, we define the actual command that will be executed. Here we can also add tests etc (you know the Gradle commands available…)

And that’s it. Now, whenever you push new commits to your repository, Gitlab will automatically perform a build on Gitlab CI’s free shared runners hosted on DigitalOcean.

After a successful build, we set the archives/files that we want to save for later download. Which, in this case, are just all file in the build/outputs/ folder. That includes Lint results, APKs, etc…

 

I hope this helps a lot of Android devs to setup their Android projects with Gitlab-CI

Kategorien
Android

TextView – getTextSize() vs setTextSize()

komedi_1419026753657_984

I decided to resume publishing some of the Android related issues that I stumble upon and workarounds and fixes for these issues.

So today I need to reduce the text size of the TextView in code at runtime. Easy peasy, I thought.

textView.setTextSize(textView.getTextSize-1);

Well, it didn’t work. Instead, the text size was now much much bigger then it was before. What? Bigger? Yes! But why?

That confusing thing behind this is that you have to realize that the two function have different measurement units as parameters and return values.

TextView.getTextSize()  returns the size in pixels and TextView.setTextSize(…)  expects the value to be in „scale independent pixels (SP)“.

So what I ended up doing is:

float oneSp = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 1, getResources().getDisplayMetrics());
textView.setTextSize((textView.getTextSize()/oneSp) - 1);

Another approach would be to use the second function to set the text size which also accepts the unit, which would be TypedValue.COMPLEX_UNIT_PX  in this case:

textView.setTextSize(TypedValue.COMPLEX_TYPE_PX, textView.getTextSize() - 1);

 

Kategorien
Android

Easy Burst Camera

Hey everyone,

another weekend, another app implemented 😉 This time I thought I’d give a burst shot camera app a chance.

I wanted to make it as easy to use and yet powerful. So there is „Easy Burst Camera“.

Features:

  • Different capture modes (Hold to capture, Auto-shot, …)
  • Set shot interval from 100ms to 2sec
  • Set number of shots to take
  • Set a timer
  • Share shots via Google+, Facebook, Twitter, etc…
  • Create an animated GIF from your shots

As always, the app is completely free and has ads. If it will be a success I will add a remove-ads in-app purchase as usual.

I’d be happy to read your feedback, either here or in the Play Store 🙂

Play Store: https://play.google.com/store/apps/details?id=de.goddchen.android.easyburstcamera

device-2013-11-03-041942 device-2013-11-03-042021 device-2013-11-03-042046

 

 

Goddchen

Kategorien
Android

FingerPlay MIDI (Reborn)

Recently I was contacted by a desperate user of the FingerPlay MIDI Android app. He was requesting a feature from the developers of the app for several weeks but hadn’t received any response, neither has the app received any updates or reactions on their issue trackerTheir blog post for the app is filled with unanswered comments.

So I went and sent several emails to the developers – without an answer 🙁 So I decided to just go forward and move the open source project to GitHub and continue to developer and support it myself.

In order to make it even possible to invest some hours each month in the app, the only solution I could think of is a subscription model. So if you are using this awesome app actively, please subscribe so that I can actively keep improving it and giving support.

So, here are some important links for you:

device-2013-06-15-014956 device-2013-06-15-015044 device-2013-06-15-015126 device-2013-06-15-015147

Goddchen

Kategorien
Android

Public Beta: Easy Clound Notes

Hey everyone,

I have lately published Beta2 of my new app „Easy Cloud Notes“.

Go ahead and grab it from this Drive folder:
https://drive.google.com/folderview?id=0B3m7udRtUYhCX2ZkUkxtRktpOEU&usp=sharing

I’m happy about any feedback!

Goddchen

Kategorien
Android

Easy App Toolbox (Backup) – Android App

Easy App Toolbox

With this post, I want to make the latest version of my app „Easy App Toolbox“ available to everyone.

For the past few weeks, it has only been available on the Play Store. But since there are many usescases for people that don’t even have the Play Store available on their devices, here is a link to my Dropbox folder with all the latest versions of this great app (starting with the current one: beta2-6)!

Dropbox Folder for Easy App Toolbox

And a quote from the Play Store description 🙂

Root NOT required!!!

With Easy App Toolbox you have a lot of useful utilities at hand to handle your apps.

Did you ever want to share an app with a friend that doesn’t have the Play Store on his device? No problem with Easy App Toolbox – simply send it to him via Gmail, etc…

Want to take backups of your installed apps because you need to wipe / factory reset your phone? No problem with Easy App Toolbox!

Ever wanted to send an installed app from one of your devices to another device? Not a problem with Easy App Toolbox – simply make a cloud backup on Box.net, Dropbox or Google Drive, and restore the backup on the other device!

If you compare Easy App Toolbox to the lately released Carbon backup app you will quickly notice the one big advantage: the free version of Carbon backup doesn’t offer any cloud features (you will have to purchase Carbon backup premium to get the cloud features), where in Easy App Toolbox, you have access to all cloud services in the free version. Plus, of course, the non backup and restore related features of Easy App Toolbox 🙂

Easy App Toolbox features:
* Send your installed apps (APK files) to your friends (via Gmail, etc…)
* Backup and Restore your apps to/from Dropbox
* Backup and Restore your apps to/from Google Drive
* Backup and Restore your apps to/from Box.net
* Backup and restore your apps to/from SD card
* Backup your apps to your PC
* View many detailed information about your installed apps (permissions, activities, services, files and folders, etc…)
* Easy uninstaller – gives you batch uninstalls 🙂

In the free version you will have absolute no ads (well, besides my own app wall where you can find my other apps, but that’s is totally non intrusive, no popups or banners or anything!) and you will be able to select up to 3 apps in each screen. With a new approach of an in-app purchase, you can inlock unlimited selections easily. And the best part about this: YOU can decide how much this is worth to you 🙂

Please note: This is the very first BETA release of the app. It will still have some issues, please don’t give bad ratings before reaching out to me with some feedback 🙂 Thanks

I hope you will enjoy this app and if you want to ask a question or anything, use the comments 🙂

Goddchen

 

Kategorien
Android

Apache Commons-Codec – Android compatible!

Hey everyone,

does

Could not find method org.apache.commons.codec.binary.Hex.encodeHexString,
referenced from method org.apache.commons.codec.digest.DigestUtils.shaHex

and the like sound familiar to you?

Well, the reason for these issues is that Android already interally includes an old version of Apache Commons-Codec that simply doesn’t have those methods available yet.

So, easy fix you would guess: include the latest jar file of Apache Commons-Codec and you’re ready to use all the cool stuff.

Well, unfortunately not. it seems that the internal version has a higher priority then the jars that your provide with your APK.

So, the only solution I saw to simply rename the package name of the classes and create a jar with that new package name. So I forked the commons-codec GitHub project, renamed the package name from „org.apache.commons.codec“ to „org.apache.commons.codec.android“ and the resulting jar file can easily be used within your project and you can easily use all the handy classes of Apache’s latest Commons-Codec 🙂

Check out my GitHub repo:

https://github.com/Goddchen/commons-codec

Kategorien
Allgemein Android

My Nexus 4 Journey – Phase 4

  • Convert my current standard SIM card to micro SIM: check 🙂
Kategorien
Allgemein Android

My Nexus 4 Journey – Phase 3

It’s on its way 🙂