Skip to content

Instantly share code, notes, and snippets.

View trongvu's full-sized avatar

Trong Vu trongvu

  • Ha Noi
View GitHub Profile
@trongvu
trongvu / RuntimeSample.java
Created February 17, 2019 11:51
Runtime.exec
public void onCLick(View view) {
String cmd = "monkey -p com.google.android.calculator --throttle 200 -v 10000";
try {
final Process p = Runtime.getRuntime().exec(cmd);
new Thread(() -> {
try {
InputStreamReader isr = new InputStreamReader (p.getInputStream());
BufferedReader br = new BufferedReader(isr);
while (true) {
String s = br.readLine ();
cd ${WORKSPACE}
rm -rf local.properties
echo "sdk.dir=/home/jenkins/tools/android-sdk-linux/" > local.properties
echo "ndk.dir=/home/jenkins/tools/android-ndk-r14b/" >> local.properties
#license
mkdir -p /home/jenkins/tools/android-sdk-linux/licenses
echo "8933bad161af4178b1185d1a37fbf41ea5269c55" > /home/jenkins/tools/android-sdk-linux/licenses/android-sdk-license
echo "d56f5187479451eabf01fb78af6dfcb131a6481e" >> /home/jenkins/tools/android-sdk-linux/licenses/android-sdk-license
#!/bin/bash
export image_name="android:5.0"
export container_name=${USER}_${image_name}
if [ ! "$(docker ps -q -f name=${container_name})" ]
then
if [ "$(docker ps -aq -f status=exited -f name=${container_name})" ]; then
# cleanup
docker rm ${container_name}
fi
# run your container
@trongvu
trongvu / build.gradle
Created January 2, 2019 02:09
Inlcude Custom Android framework jar to Android Studio
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
@trongvu
trongvu / android_utils.h
Created October 20, 2017 03:12
Utils class to get package name, signature in NDK
//
// Created by vntrong on 10/20/2017.
//
#ifndef ANDROID_UTILS_H
#define ANDROID_UTILS_H
#include <jni.h>
#include <string.h>
#include <string>