Skip to main content

Posts

Showing posts from 2017

Failed to resolve: com.android.support:cardview-v7:26.0.0 android and similar

Recently I updated my android SDK tools and I started getting this error Failed to resolve: com.android.support:cardview-v7:26.0.0 android Solution to this or any other similar error is to add maven end point in your build.gradle file allprojects {     repositories {         jcenter()         maven {             url 'https://maven.google.com'         }     } } 

Ionic2 Error Could not find an installed version of Gradle either in Android Studio, or on your system to install the gradle wrapper

Recently I upgraded to latest version of ionic and started getting following error when building app for android Error: Could not find an installed version of Gradle either in Android Studio, or on your system to install the gradle wrapper. Please include gradle in your path, or install Android Studio To solve this issue you have to perform following steps Download Gradle from https://gradle.org/install/#manually Extract the downloaded zip file somewhere (e.g. D:\gradle) Add "D:\gradle\bin" to Path in your Environment variables After performing these steps everything started working fine for me. Hope you find this helpful :)

Encoding raw images to Ogg Theora video using libavcodec

In one of the blog posts we learned how to decode jpeg images using libavcodec. This is the second part of that post. In this we will learn how to encode decoded images (raw images) to theora and write them in ogg video file. In the end of the first part we saved our raw image in raw_data variable and its length in raw_data_size variable. Lets assume that we packaged all our decoding code in one function called "decode_jpeg_image" which has following signature int decode_jpeg_image(char *filename,int file_name_size,uint8_t *raw_data,int *raw_data_size) filename = name of jpeg file to decode file_name_size = length of jpeg file's name raw_data = contains decoded raw image on return raw_data_size = contains length of raw_data on return Now let's start working on how to encode this image in raw_data to theora and write that image to ogg video file. Finding Theora encoder We first have to find encoder for THEORA which is represented by AVCodec structure. He

Ionic1 scrolling bounce effect not working in android

I faced a weird problem in my recent ionic1 app. App is a social network that shows news feed. When I tested in browsers scrolling was smooth and when end of list is reached ionic's bouncing effect shows up. But running the app in android do not show any bouncy effects instead its just a "hard scrolling". After reading the docs I realized that bouncy effect is disabled in android by default so i have to add has-bouncing="true" in ion-content . So I added it <ion-content class="has-header" has-bouncing="true"> But still I didn't  get bouncy effect on end of scroll. It was same "hard scrolling" that just stops when end of list is reached without showing any effect. To solve this issue we have to add overflow-scrolling="false" in our ion-content along with has-bouncing="true" <ion-content class="has-header" overflow-scroll="false" has-bouncing="true">

ionic2 - cordova camera plugin content:// in img tag , image not displayed

Recently in ionic2 I faced a weird problem when using camera plugin  in android  . My app simply allows user to either take picture from camera or select image from gallery. When user takes picture from camera everything works fine but if user selects image from gallery , image is not displayed (using img tag). Very first difference i spotted between camera and gallery image was the uri of file. Camera image has following format file:///path/to/image.jpg where gallery image has following format content://media/external/image/238 I debugged my project using Android Studio and I found that when i try to display gallery image using img tag , following error is shown in console URL blocked by whitelist  It was clear that whitelist plugin is blocking content:// requests so I tried to add content:// as whitelisted uri in my config.xml . I added the following lines <access origin="content://*" /> <allow-nagivation href="content://*" /> BUT TO NO

Ionic2 - Blank white screen for long time before showing root page

I recently upgraded to ionic2 from ionic1. Ionic2 is better than ionic1 in so many ways but one problem that I started facing in my apps built for android was annoying the hell out of my clients. Problem was, that before showing the first screen of app (a.k.a root page) there was a blank white screen for approx 10-12 (and sometimes 15) seconds. First I thought it may be because of many plugins installed but problem was there even in a newly created project based on blank template. How I was building my apk was very simple cordova build --release android After completing all the steps listed here I deploy my apk to device. But after little reading on internet about this white screen issue I found that command to generate production ready build is as follows ionic build android --release --prod This solved my white screen problem and now my Root page appears just after 1-2 secs of launching my app.