Android Jnitest

Alternatives To Android Jnitest
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Androiddevtools7,528
13 days ago4
收集整理Android开发所需的Android SDK、开发中用到的工具、Android开发教程、Android设计规范,免费的设计素材等。
Matcha3,454
5 years ago3November 09, 201721apache-2.0Go
Build native mobile apps in Go.
Rawdrawandroid2,246
2 months ago3mitC
Build android apps without any java, entirely in C and Make
Moonlight Android2,049
14 hours ago90gpl-3.0C
GameStream client for Android
Android1,172
9 days ago105otherKotlin
MEGA Android App
Deltachat Android922
15 hours ago58gpl-3.0Java
Email-based instant messaging for Android.
Android Vulkan Tutorials741
a month ago2apache-2.0C++
A set of samples to illustrate Vulkan API on Android
Chapter01388
4 years ago8C++
Chapter01 GeekTime ,crash catch sample
Vulkan Basic Samples384
2 years ago1otherC++
Drishti304
4 years ago64bsd-3-clauseC++
Real time eye tracking for embedded and mobile devices.
Alternatives To Android Jnitest
Select To Compare


Alternative Project Comparisons
Readme

Android-JNITest

Android Studio JNI environment.
Android Studio JNI


Android Studio + NDKJNI

NDKJNI
NDKNative Development Kit

The NDK is a toolset that allows you to implement parts of your app using native-code languages such as C and C++.

NDKCC++

JNIJava Native Interface
APIJavaC&C++Java1.1JNIjavaJava

  • 1.Android Studio
  • 2.Android

Android StudioNDK

  • 1.LLDB+NDK

  • 2.NDK


javah
ndk-build
ndk-build clean

	javah	
	Program$JDKPath$/bin/javah
	-encoding UTF-8
	Parameters-encoding UTF-8 -d ../jni -jni $FileClass$
	Working directory$SourcepathEntry$\..\java

	ndk-build	so
	MAC/Linuxndk-build.cmd
	ProgramC:\Develop\Android\sdk\ndk-bundle\ndk-build.cmd
	Parameters
	Working directory$ModuleFileDir$\src\main

	ndk-build clean	so
	MAC/Linuxndk-build.cmd
	ProgramC:\Develop\Android\sdk\ndk-bundle\ndk-build.cmd
	Parametersclean
	Working directory$ModuleFileDir$\src\main

  • gradle.properties
	android.useDeprecatedNdk=true

	buildscript {
	    repositories {
		jcenter()
	    }
	    dependencies {
		//	build:gradlebuild:gradle-experimental
        	classpath "com.android.tools.build:gradle-experimental:0.7.0"
		//        classpath 'com.android.tools.build:gradle:2.1.2'
	    }
	}
	
	allprojects {
	    repositories {
	        jcenter()
	    }
	}
	//
	task clean(type: Delete) {
	    delete rootProject.buildDir
	}
  • 2.gradle->wrapper->gradle-wrapper.properties
	#Mon Dec 28 10:00:20 PST 2015
	distributionBase=GRADLE_USER_HOME
	distributionPath=wrapper/dists
	zipStoreBase=GRADLE_USER_HOME
	zipStorePath=wrapper/dists
	distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip//
  • gradle-experimentalgradle-wrapper

  • 3.app->build.gradle

	
	apply plugin: 'com.android.application'
	
	android {
	    compileSdkVersion 23
	    buildToolsVersion "23.0.3"
	
	    defaultConfig {
	        applicationId "com.jeanboy.demo.jnitest"
	        minSdkVersion 15
	        targetSdkVersion 23
	        versionCode 1
	        versionName "1.0"
	    }
	    buildTypes {
	        release {
	            minifyEnabled false
	            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
	        }
	    }
	}
	
	dependencies {
	    compile fileTree(dir: 'libs', include: ['*.jar'])
	    compile 'com.android.support:appcompat-v7:23.4.0'
	}
	
	apply plugin: 'com.android.model.application'//
	//apply plugin: 'com.android.application'
	
	model {//
	    android {
	        compileSdkVersion 23
	        buildToolsVersion "23.0.3"
	
	        defaultConfig {
	            applicationId "com.jeanboy.demo.jnitest"
	            minSdkVersion.apiLevel 15
	            targetSdkVersion.apiLevel 23
	            versionCode   1
	            versionName   "1.0"
	        }
	
	        ndk {//libnative.so
	            moduleName   "NdkTest"
	        }
	
	        buildTypes {
	            release {
	                minifyEnabled false
	                proguardFiles.add(file("proguard-rules.pro"))//
	            }
	        }
	
	    }
	
	}
	
	dependencies {
	    compile fileTree(dir: 'libs', include: ['*.jar'])
	    compile 'com.android.support:appcompat-v7:23.4.0'
	}
  • 4.jni
    jni

  • 5.NdkTest.java

	public class NdkTest {
	    static {
	        System.loadLibrary("NdkTest");//so
	    }
		//native
	    public static native String getString();
	    public static native int doAdd(int param1,int param2);
	}
  • 6.NdkTest.hNdkTest.cppNdkTest.hnative
    NdkTest.h

NdkTest.h

	/* DO NOT EDIT THIS FILE - it is machine generated */
	#include <jni.h>
	/* Header for class com_jeanboy_demo_jnitest_NdkTest */
	
	#ifndef _Included_com_jeanboy_demo_jnitest_NdkTest
	#define _Included_com_jeanboy_demo_jnitest_NdkTest
	#ifdef __cplusplus
	extern "C" {
	#endif
	/*
	 * Class:     com_jeanboy_demo_jnitest_NdkTest
	 * Method:    getString
	 * Signature: ()Ljava/lang/String;
	 */
	JNIEXPORT jstring JNICALL Java_com_jeanboy_demo_jnitest_NdkTest_getString
	  (JNIEnv *, jclass);//native
	
	/*
	 * Class:     com_jeanboy_demo_jnitest_NdkTest
	 * Method:    doAdd
	 * Signature: (II)I
	 */
	JNIEXPORT jint JNICALL Java_com_jeanboy_demo_jnitest_NdkTest_doAdd
	  (JNIEnv *, jclass, jint, jint);//native
	
	#ifdef __cplusplus
	}
	#endif
	#endif

NdkTest.cpp

	#include "com_jeanboy_demo_jnitest_NdkTest.h"

	JNIEXPORT jstring JNICALL Java_com_jeanboy_demo_jnitest_NdkTest_getString
	        (JNIEnv *env, jclass type) {//
	
	    return env->NewStringUTF("hello world!!!");
	}
	
	/*
	 * Class:     com_jeanboy_demo_jnitest_NdkTest
	 * Method:    doAdd
	 * Signature: (II)I
	 */
	JNIEXPORT jint JNICALL Java_com_jeanboy_demo_jnitest_NdkTest_doAdd
	        (JNIEnv *env, jclass type, jint param1, jint param2) {//
	
	    return param1 + param1;
	}
  • 7.jniAndroid.mkApplication.mk

Android.mk

	LOCAL_PATH := $(call my-dir)
	include $(CLEAR_VARS)
	
	LOCAL_MODULE := NdkTest//moduleName
	LOCAL_SRC_FILES := NdkTest.cpp//NdkTest.cpp
	include $(BUILD_SHARED_LIBRARY)

Application.mk

	APP_MODULES := NdkTest
	/*NDKAndroid.mk(makefile)
	APP_MODULESAndroid.mkLOCAL_MODULE
	NDK*/
	APP_ABI := all//armeabi armeabi-v7a x86
	AndroidCPU

	ARMv5ARMv7 (2010)
	x86 (2011)
	MIPS (2012)
	ARMv8MIPS64x86_64 (2014)

	CPUABI
	CPU			ABI
	ARMv5	--->	armeabi
	ARMv7	--->	armeabi-v7a
	x86		--->	x86
	MIPS	--->	mips
	ARMv8	--->	arm64-v8a
	MIPS64	--->	mips64
	x86_64	--->	x86_64

	armeabiARM* v5TE  
	 ABI
	 ARM*armeabi

	armeabi-v7aARM* v7 FPU
	armeabi-v7aarm v7 cpu

	mipsMIPSRISCMIPS
	(Microprocessor without interlocked piped stages)
	

	x86IA-32 x86armeabi
	armeabi-v7aarmeabi
	x86soarmeabi

	
	 armeabiAndroid
	 armeabi-v7aarmeabi 
	 x86armeabiarmeabi-v7aAndroid
	
	 armeabiarmeabi-v7ax86
	so
	
  • 8.so
    so

  • 9.native

	NdkTest.getString();
	NdkTest.doAdd(5, 12);
  • 10.app

star follow

issue request [email protected]

QQ

Android386463747

License

Copyright 2015 jeanboy

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
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Popular Android Studio Projects
Popular Ndk Projects
Popular Integrated Development Environments Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Android Studio
Ndk