Menu Home


Android Gradle: SDK License Agreements

* What went wrong: A problem occurred configuring project ‘:mi’. > Failed to notify project evaluation listener. > You have not accepted the license agreements of the following SDK components: [Android SDK Build-Tools 25]. Before building your project, you need to accept the license agreements and complete the installation of […]

Android:Build x264 for arm64

export NDK=$ANDROID_NDK export PREBUILT_ARM64=$NDK/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64 export X264_ANDROID_PREFIX_ARM64=$X264_BUILD_ROOT/output/arm64 function build_arm64 { ./configure \ –prefix=$X264_ANDROID_PREFIX_ARM64 \ –enable-static \ –enable-pic \ –host=aarch64-linux \ –cross-prefix=$PREBUILT_ARM64/bin/aarch64-linux-android- \ –sysroot=$PLATFORM_ARM64 make clean make make install echo “Build libx264 arm64 Finished !!!” } If you compile ffmpeg with libx264.a , you MUST use same NDK toolchains. Otherwise cannot link […]

Build WebRTC

First of All, You have evaded the “WALL”. God bless you. Host OS: Ubuntu 16.04 LTE Build Tools git clone Then add depot_tools to your PATH Checkout Source Set the target OS Here, I will build webrtc for Andorid platform. export GYP_DEFINES=”OS=android” Sync Source mkdir webrtc_android cd webrtc_android fetch […]

Android:Get Certificate SHA1 with JNI

#include <assert.h> #include <string.h> #include <stdio.h> #include <android/log.h> const char HexCode[]={‘0′,’1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9′,’A’,’B’,’C’,’D’,’E’,’F’}; static void byte_array_to_hex_string(JNIEnv *env, const jbyteArray array, const jsize array_size, char *hex_string) { jbyte *sha1 = (*env)->GetByteArrayElements(env, array, NULL); for (int i = 0; i < array_size; i++) { hex_string[i * 2] = HexCode[((unsigned char)sha1[i]) / 16]; hex_string[i * […]

Android FW: Create Floating Window

private void initFloatingWindow() { mWindowManager = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE); mWindow = PolicyManager.makeNewWindow(mContext); mWindow.setWindowManager(mWindowManager, null, null); mWindow.requestFeature(Window.FEATURE_NO_TITLE); mDecor = mWindow.getDecorView(); mDecor.setOnTouchListener(mTouchListener); mWindow.setContentView(this); mWindow.setBackgroundDrawableResource(android.R.color.transparent); // While the media controller is up, the volume control keys should // affect the media stream type mWindow.setVolumeControlStream(AudioManager.STREAM_MUSIC); setFocusable(true); setFocusableInTouchMode(true); setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); requestFocus(); } ref:

Android: Check Long Press Helper

基本思想: 在Down事件中向UI线程塞入一个定时任务,如果在定时时间终了前任务没有被取消,就认为是一个长按事件。 /* * Copyright (C) 2012 The Android Open Source Project * * 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 * * * […]

Android:FragmentPagerAdapter Demo

package com.example.sijiewang.testviewpager; import android.os.Bundle; import; import; import; import; import; import java.util.ArrayList; public class MainActivity extends FragmentActivity { private ViewPager mAlarmCreateViewPager; private Fragment mFragmentOne; private Fragment mFragmentTwo; private ArrayList<Fragment> mFragmentList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mFragmentList = new ArrayList<Fragment>(2); mFragmentOne = new mFragmentOne(); […]