Skip to content

Instantly share code, notes, and snippets.

@skyisle
skyisle / maven4android 4.2.2.1.diff
Last active December 14, 2015 18:09
Add android sdk 4.2.2.1 support to android4maven( https://sourceforge.net/projects/android4maven/ )
Index: compare.sh
===================================================================
--- compare.sh (revision 55)
+++ compare.sh (working copy)
@@ -37,9 +37,13 @@
#export platform=android-14
# android-16
-export pomVersion=4.1.1.4
-export platform=android-16
@skyisle
skyisle / gist:5140127
Created March 12, 2013 03:40
android4maven-code/android-sdk/target-4.1.1.4
[INFO] ------------------------------------------------------------------------
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Google Android Library (Implementation) 4.1.1.4
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.3:clean (default-clean) @ android-impl ---
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ android-impl ---
(function () {
var f = !0,
g = null,
h = !1,
aa = function (a, b, c) {
return a.call.apply(a.bind, arguments)
}, ba = function (a, b, c) {
if (!a) throw Error();
if (2 < arguments.length) {
var d = Array.prototype.slice.call(arguments, 2);
@skyisle
skyisle / gist:5500427
Created May 2, 2013 06:07
Adsense Android 4.0.3+ devicemotion crash workaround
class WebViewClientEx extends WebViewClient {
private static final String URL_ADSENSE_SHOW_ADS_JS
= "pagead2.googlesyndication.com/pagead/show_ads.js";
public android.webkit.WebResourceResponse shouldInterceptRequest(WebView view, String url) {
if (Build.VERSION.SDK_INT >= 15
&& url.endsWith(URL_ADSENSE_SHOW_ADS_JS)) {
HttpURLConnection conn = null;
try {
@skyisle
skyisle / new_gist_file
Created May 7, 2013 15:33
okhttp crash
180 DEBUG I *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
180 DEBUG I Build fingerprint: 'lge/geehrc_open_eu/geehrc:4.1.2/JZO54K/E97510b.1360741472:user/release-keys'
180 DEBUG I Revision: '11'
180 DEBUG I pid: 14422, tid: 14477, name: GAThread >>> com.alanjeon.twitplus <<<
180 DEBUG I signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
180 DEBUG I r0 74e4bb1c r1 ffffffff r2 00000008 r3 731a8065
180 DEBUG I r4 731a8065 r5 731a8066 r6 00000000 r7 731a8065
180 DEBUG I r8 00000020 r9 731a8065 sl 00000000 fp 74e4bb1c
180 DEBUG I ip 6f218da0 sp 74e4ba98 lr 6f2012f3 pc 40a99430 cpsr 000d0030
180 DEBUG I d0 0000000000000000 d1 0000000000000000
@skyisle
skyisle / MyActivity.java
Created May 10, 2013 08:43
crash reproduce with okhttp
package com.alanjeon.okhttptest;
import com.squareup.okhttp.OkHttpClient;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
@skyisle
skyisle / build.gradle
Last active December 17, 2015 10:38
skeleton of android gradle build file
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
apply plugin: 'android'
@skyisle
skyisle / build.gradle
Last active December 19, 2015 23:49
Using annotation processing in gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
/*
* Copyright 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@skyisle
skyisle / build.gradle
Last active December 23, 2015 14:39
get versionCode from manifest
def getVersionCodeFromManifest() {
def manifestContent = file(android.sourceSets.main.manifest.srcFile).getText()
def matcher = (~"versionCode=\"(\\d+)\"").matcher(manifestContent)
matcher.find()
return Integer.parseInt(matcher.group(1))
}
def getVersionCodeFromManifestLong() {
def manifestFile = android.sourceSets.main.manifest.srcFile
def xpath = XPathFactory.newInstance().newXPath()