2021.04.08
完善ndk使用
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -78,3 +78,4 @@ lint/tmp/
|
|||||||
/.idea/
|
/.idea/
|
||||||
/gradlew.bat
|
/gradlew.bat
|
||||||
/gradlew
|
/gradlew
|
||||||
|
/app/.cxx/
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.tt.ttutils"
|
applicationId "com.tt.ttutils"
|
||||||
minSdkVersion 16
|
minSdkVersion 24
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
// versionCode 1
|
// versionCode 1
|
||||||
// versionName "1.0"
|
// versionName "1.0"
|
||||||
@@ -26,8 +26,8 @@ android {
|
|||||||
|
|
||||||
ndk {
|
ndk {
|
||||||
//选择要添加的对应 cpu 类型的 .so 库。
|
//选择要添加的对应 cpu 类型的 .so 库。
|
||||||
abiFilters 'armeabi', 'armeabi-v7a', 'arm64-v8a','x86'
|
abiFilters 'armeabi-v7a', 'arm64-v8a'
|
||||||
// 还可以添加 'x86', 'x86_64', 'mips', 'mips64'
|
// 还可以添加 'armeabi' , 'x86', 'x86_64', 'mips', 'mips64'
|
||||||
}
|
}
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
JPUSH_PKGNAME: applicationId,
|
JPUSH_PKGNAME: applicationId,
|
||||||
@@ -35,6 +35,12 @@ android {
|
|||||||
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
|
JPUSH_CHANNEL: "developer-default", //暂时填写默认值即可.
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
exclude 'META-INF/DEPENDENCIES'
|
exclude 'META-INF/DEPENDENCIES'
|
||||||
exclude 'META-INF/LICENSE'
|
exclude 'META-INF/LICENSE'
|
||||||
@@ -72,7 +78,7 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
sourceSets {
|
sourceSets {
|
||||||
beta.res.srcDirs = ['src/beta/res']
|
beta.res.srcDirs = ['src/beta/res']
|
||||||
}
|
}
|
||||||
|
|
||||||
//签名
|
//签名
|
||||||
@@ -97,6 +103,15 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
externalNativeBuild {
|
||||||
|
ndkBuild {
|
||||||
|
path 'src/main/jni/Android.mk'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sourceSets.main {
|
||||||
|
jni.srcDirs = []
|
||||||
|
jniLibs.srcDirs = ['src/main/jniLibs']
|
||||||
|
}
|
||||||
debug {
|
debug {
|
||||||
// 显示Log
|
// 显示Log
|
||||||
buildConfigField "boolean", "LOG_DEBUG", "true"
|
buildConfigField "boolean", "LOG_DEBUG", "true"
|
||||||
@@ -169,6 +184,9 @@ dependencies {
|
|||||||
//Jackson
|
//Jackson
|
||||||
implementation 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
|
implementation 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
|
||||||
implementation 'org.codehaus.jackson:jackson-core-asl:1.9.13'
|
implementation 'org.codehaus.jackson:jackson-core-asl:1.9.13'
|
||||||
|
//view绑定
|
||||||
|
implementation 'com.jakewharton:butterknife:10.1.0'
|
||||||
|
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
|
||||||
//二维码
|
//二维码
|
||||||
implementation 'com.google.zxing:core:3.3.0'
|
implementation 'com.google.zxing:core:3.3.0'
|
||||||
|
|
||||||
|
|||||||
@@ -20,14 +20,18 @@
|
|||||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <!-- 华为角标 -->
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||||
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" /> <!-- Optional for location -->
|
<!-- 华为角标 -->
|
||||||
|
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE" />
|
||||||
|
<!-- Optional for location -->
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 用于开启 debug 版本的应用在6.0 系统上 层叠窗口权限 -->
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||||
|
<!-- 用于开启 debug 版本的应用在6.0 系统上 层叠窗口权限 -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> <!-- Android Q后台定位权限 -->
|
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||||
|
<!-- Android Q后台定位权限 -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
|
||||||
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
|
||||||
<uses-permission android:name="android.permission.GET_TASKS" />
|
<uses-permission android:name="android.permission.GET_TASKS" />
|
||||||
@@ -41,7 +45,20 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme">
|
android:theme="@style/AppTheme">
|
||||||
<activity android:name="com.tt.activity.PackageActivity"></activity>
|
<activity android:name="com.tt.activity.PackageActivity"></activity>
|
||||||
|
<activity android:name="com.tt.activity.JMainActivity" >
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name="com.tt.activity.MainActivity">
|
||||||
|
<!-- <intent-filter>-->
|
||||||
|
<!-- <action android:name="android.intent.action.MAIN" />-->
|
||||||
|
|
||||||
|
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
|
||||||
|
<!-- </intent-filter>-->
|
||||||
|
</activity>
|
||||||
<receiver
|
<receiver
|
||||||
android:name="com.tt.receiver.PackageReceiver"
|
android:name="com.tt.receiver.PackageReceiver"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
@@ -86,19 +103,15 @@
|
|||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<activity android:name="com.tt.activity.MainActivity">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.MAIN" />
|
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<!-- -->
|
||||||
</intent-filter>
|
|
||||||
</activity> <!-- -->
|
|
||||||
<!-- Rich push 核心功能 since 2.0.6 -->
|
<!-- Rich push 核心功能 since 2.0.6 -->
|
||||||
<activity
|
<activity
|
||||||
android:name="cn.jpush.android.ui.PopWinActivity"
|
android:name="cn.jpush.android.ui.PopWinActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:theme="@style/MyDialogStyle"
|
android:theme="@style/MyDialogStyle"
|
||||||
tools:replace="android:exported" /> <!-- Required SDK核心功能 -->
|
tools:replace="android:exported" />
|
||||||
|
<!-- Required SDK核心功能 -->
|
||||||
<activity
|
<activity
|
||||||
android:name="cn.jpush.android.ui.PushActivity"
|
android:name="cn.jpush.android.ui.PushActivity"
|
||||||
android:configChanges="orientation|keyboardHidden"
|
android:configChanges="orientation|keyboardHidden"
|
||||||
@@ -111,7 +124,8 @@
|
|||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="${applicationId}" />
|
<category android:name="${applicationId}" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity> <!-- Required SDK 核心功能 -->
|
</activity>
|
||||||
|
<!-- Required SDK 核心功能 -->
|
||||||
<!-- 可配置android:process参数将PushService放在其他进程中 -->
|
<!-- 可配置android:process参数将PushService放在其他进程中 -->
|
||||||
<service
|
<service
|
||||||
android:name="cn.jpush.android.service.PushService"
|
android:name="cn.jpush.android.service.PushService"
|
||||||
@@ -122,12 +136,14 @@
|
|||||||
<action android:name="cn.jpush.android.intent.PushService" />
|
<action android:name="cn.jpush.android.intent.PushService" />
|
||||||
<action android:name="cn.jpush.android.intent.PUSH_TIME" />
|
<action android:name="cn.jpush.android.intent.PUSH_TIME" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service> <!-- since 3.0.9 Required SDK 核心功能 -->
|
</service>
|
||||||
|
<!-- since 3.0.9 Required SDK 核心功能 -->
|
||||||
<provider
|
<provider
|
||||||
android:name="cn.jpush.android.service.DataProvider"
|
android:name="cn.jpush.android.service.DataProvider"
|
||||||
android:authorities="${applicationId}.DataProvider"
|
android:authorities="${applicationId}.DataProvider"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:process=":pushcore" /> <!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
|
android:process=":pushcore" />
|
||||||
|
<!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
|
||||||
<!-- 若不启用该功能可删除该组件,或把 enabled 设置成 false ;App 不会被其他 App 拉起,但会拉起其他的 App。 -->
|
<!-- 若不启用该功能可删除该组件,或把 enabled 设置成 false ;App 不会被其他 App 拉起,但会拉起其他的 App。 -->
|
||||||
<service
|
<service
|
||||||
android:name="cn.jpush.android.service.DaemonService"
|
android:name="cn.jpush.android.service.DaemonService"
|
||||||
@@ -138,7 +154,8 @@
|
|||||||
|
|
||||||
<category android:name="${applicationId}" />
|
<category android:name="${applicationId}" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service> <!-- 可选,如果使用静态Activity方式拉起,该组件必须声明 -->
|
</service>
|
||||||
|
<!-- 可选,如果使用静态Activity方式拉起,该组件必须声明 -->
|
||||||
<activity
|
<activity
|
||||||
android:name="cn.jpush.android.service.DActivity"
|
android:name="cn.jpush.android.service.DActivity"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
@@ -150,16 +167,19 @@
|
|||||||
|
|
||||||
<category android:name="${applicationId}" />
|
<category android:name="${applicationId}" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity> <!-- since 3.1.0 Required SDK 核心功能 -->
|
</activity>
|
||||||
|
<!-- since 3.1.0 Required SDK 核心功能 -->
|
||||||
<provider
|
<provider
|
||||||
android:name="cn.jpush.android.service.DownloadProvider"
|
android:name="cn.jpush.android.service.DownloadProvider"
|
||||||
android:authorities="${applicationId}.DownloadProvider"
|
android:authorities="${applicationId}.DownloadProvider"
|
||||||
android:exported="true" /> <!-- Required SDK核心功能 -->
|
android:exported="true" />
|
||||||
|
<!-- Required SDK核心功能 -->
|
||||||
<receiver
|
<receiver
|
||||||
android:name="cn.jpush.android.service.PushReceiver"
|
android:name="cn.jpush.android.service.PushReceiver"
|
||||||
android:enabled="true">
|
android:enabled="true">
|
||||||
<intent-filter android:priority="1000">
|
<intent-filter android:priority="1000">
|
||||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" /> <!-- Required 显示通知栏 -->
|
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />
|
||||||
|
<!-- Required 显示通知栏 -->
|
||||||
<category android:name="${applicationId}" />
|
<category android:name="${applicationId}" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@@ -173,26 +193,36 @@
|
|||||||
|
|
||||||
<data android:scheme="package" />
|
<data android:scheme="package" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver> <!-- Required SDK核心功能 -->
|
</receiver>
|
||||||
|
<!-- Required SDK核心功能 -->
|
||||||
<receiver
|
<receiver
|
||||||
android:name="cn.jpush.android.service.AlarmReceiver"
|
android:name="cn.jpush.android.service.AlarmReceiver"
|
||||||
android:exported="false" /> <!-- 3.5.0新增,用于定时展示功能 -->
|
android:exported="false" />
|
||||||
|
<!-- 3.5.0新增,用于定时展示功能 -->
|
||||||
<receiver
|
<receiver
|
||||||
android:name="cn.jpush.android.service.SchedulerReceiver"
|
android:name="cn.jpush.android.service.SchedulerReceiver"
|
||||||
android:exported="false" /> <!-- 3.6.7 新增,用于负反馈组件 -->
|
android:exported="false" />
|
||||||
<service android:name="cn.jpush.android.service.MessagingIntentService" /> <!-- User defined. For test only 用户自定义的广播接收器 -->
|
<!-- 3.6.7 新增,用于负反馈组件 -->
|
||||||
|
<service android:name="cn.jpush.android.service.MessagingIntentService" />
|
||||||
|
<!-- User defined. For test only 用户自定义的广播接收器 -->
|
||||||
<receiver
|
<receiver
|
||||||
android:name="com.tt.sdk.jpush.jpushdemo.MyReceiver"
|
android:name="com.tt.sdk.jpush.jpushdemo.MyReceiver"
|
||||||
android:enabled="true">
|
android:enabled="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="cn.jpush.android.intent.REGISTRATION" /> <!-- Required 用户注册SDK的intent -->
|
<action android:name="cn.jpush.android.intent.REGISTRATION" />
|
||||||
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" /> <!-- Required 用户接收SDK消息的intent -->
|
<!-- Required 用户注册SDK的intent -->
|
||||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" /> <!-- Required 用户接收SDK通知栏信息的intent -->
|
<action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" />
|
||||||
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> <!-- Required 用户打开自定义通知栏的intent -->
|
<!-- Required 用户接收SDK消息的intent -->
|
||||||
<action android:name="cn.jpush.android.intent.CONNECTION" /> <!-- 接收网络变化 连接/断开 since 1.6.3 -->
|
<action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" />
|
||||||
|
<!-- Required 用户接收SDK通知栏信息的intent -->
|
||||||
|
<action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" />
|
||||||
|
<!-- Required 用户打开自定义通知栏的intent -->
|
||||||
|
<action android:name="cn.jpush.android.intent.CONNECTION" />
|
||||||
|
<!-- 接收网络变化 连接/断开 since 1.6.3 -->
|
||||||
<category android:name="${applicationId}" />
|
<category android:name="${applicationId}" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver> <!-- User defined. For test only 用户自定义接收消息器,3.0.7开始支持,目前新tag/alias接口设置结果会在该广播接收器对应的方法中回调 -->
|
</receiver>
|
||||||
|
<!-- User defined. For test only 用户自定义接收消息器,3.0.7开始支持,目前新tag/alias接口设置结果会在该广播接收器对应的方法中回调 -->
|
||||||
<!-- since 3.3.0 接收JPush相关事件 -->
|
<!-- since 3.3.0 接收JPush相关事件 -->
|
||||||
<receiver android:name="com.tt.sdk.jpush.jpushdemo.PushMessageReceiver">
|
<receiver android:name="com.tt.sdk.jpush.jpushdemo.PushMessageReceiver">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@@ -200,7 +230,8 @@
|
|||||||
|
|
||||||
<category android:name="${applicationId}" />
|
<category android:name="${applicationId}" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver> <!-- since 3.3.0 Required SDK核心功能 -->
|
</receiver>
|
||||||
|
<!-- since 3.3.0 Required SDK核心功能 -->
|
||||||
<activity
|
<activity
|
||||||
android:name="cn.jpush.android.service.JNotifyActivity"
|
android:name="cn.jpush.android.service.JNotifyActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
@@ -212,7 +243,8 @@
|
|||||||
|
|
||||||
<category android:name="${applicationId}" />
|
<category android:name="${applicationId}" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity> <!-- since 3.3.0 Required SDK 核心功能 -->
|
</activity>
|
||||||
|
<!-- since 3.3.0 Required SDK 核心功能 -->
|
||||||
<!-- 可配置android:process参数将PushService放在其他进程中 -->
|
<!-- 可配置android:process参数将PushService放在其他进程中 -->
|
||||||
<!-- User defined. For test only 继承自cn.jpush.android.service.JCommonService -->
|
<!-- User defined. For test only 继承自cn.jpush.android.service.JCommonService -->
|
||||||
<service
|
<service
|
||||||
@@ -221,14 +253,17 @@
|
|||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="cn.jiguang.user.service.action" />
|
<action android:name="cn.jiguang.user.service.action" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service> <!-- since 3.5.6 新增华硕通道 -->
|
</service>
|
||||||
<receiver android:name="cn.jpush.android.asus.AsusPushMessageReceiver" /> <!-- Required . Enable it you can get statistics data with channel -->
|
<!-- since 3.5.6 新增华硕通道 -->
|
||||||
|
<receiver android:name="cn.jpush.android.asus.AsusPushMessageReceiver" />
|
||||||
|
<!-- Required . Enable it you can get statistics data with channel -->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="JPUSH_CHANNEL"
|
android:name="JPUSH_CHANNEL"
|
||||||
android:value="${JPUSH_CHANNEL}" />
|
android:value="${JPUSH_CHANNEL}" />
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="JPUSH_APPKEY"
|
android:name="JPUSH_APPKEY"
|
||||||
android:value="${JPUSH_APPKEY}" /> <!-- </>值来自开发者平台取得的AppKey -->
|
android:value="${JPUSH_APPKEY}" />
|
||||||
|
<!-- </>值来自开发者平台取得的AppKey -->
|
||||||
<meta-data
|
<meta-data
|
||||||
android:name="design_width_in_dp"
|
android:name="design_width_in_dp"
|
||||||
android:value="640" />
|
android:value="640" />
|
||||||
|
|||||||
@@ -1,13 +1,22 @@
|
|||||||
package com.tt.activity;
|
package com.tt.activity;
|
||||||
|
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.tt.base.BaseActivity;
|
import com.tt.base.BaseActivity;
|
||||||
import com.tt.ttutils.R;
|
import com.tt.ttutils.R;
|
||||||
import com.tt.ttutils.java.ToastUtil;
|
import com.tt.ttutils.java.ToastUtil;
|
||||||
|
import com.tt.ttutils.jni.NDKTools;
|
||||||
|
|
||||||
|
import java.lang.annotation.Native;
|
||||||
|
|
||||||
|
import butterknife.BindView;
|
||||||
|
import butterknife.ButterKnife;
|
||||||
|
|
||||||
public class JMainActivity extends BaseActivity {
|
public class JMainActivity extends BaseActivity {
|
||||||
|
@BindView(R.id.textView)
|
||||||
|
TextView textView;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int setLayoutResourceID() {
|
protected int setLayoutResourceID() {
|
||||||
@@ -16,12 +25,13 @@ public class JMainActivity extends BaseActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initView() {
|
protected void initView() {
|
||||||
|
ButterKnife.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initData() {
|
protected void initData() {
|
||||||
|
String ndks = NDKTools.getStringFromNDK();
|
||||||
|
textView.setText(ndks);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用来计算返回键的点击间隔时间
|
// 用来计算返回键的点击间隔时间
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package com.tt.ttutils.jni;
|
|||||||
|
|
||||||
public class NDKTools {
|
public class NDKTools {
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("myMeetJni");
|
System.loadLibrary("NDKTools-jni");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static native String getStringFromNDK();
|
public static native String getStringFromNDK();
|
||||||
|
|||||||
9
app/src/main/jni/Android.mk
Normal file
9
app/src/main/jni/Android.mk
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
LOCAL_PATH := $(call my-dir)
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE := NDKTools-jni
|
||||||
|
|
||||||
|
LOCAL_SRC_FILES := NDKTools.c
|
||||||
|
|
||||||
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
13
app/src/main/jni/NDKTools.c
Normal file
13
app/src/main/jni/NDKTools.c
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// Created by Administrator on 2021/4/8.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "com_tt_ttutils_jni_NDKTools.h"
|
||||||
|
|
||||||
|
JNIEXPORT jstring JNICALL Java_com_tt_ttutils_jni_NDKTools_getStringFromNDK
|
||||||
|
//注意!!!这里要与.h文件的一致
|
||||||
|
(JNIEnv *env, jobject obj) {
|
||||||
|
return (*env)->NewStringUTF(env, "Hellow World,NDK");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
|
||||||
#include <jni.h>
|
|
||||||
/* Header for class com_tt_ttutils_jni_NDKTools */
|
|
||||||
|
|
||||||
#ifndef _Included_com_tt_ttutils_jni_NDKTools
|
|
||||||
#define _Included_com_tt_ttutils_jni_NDKTools
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
* Class: com_tt_ttutils_jni_NDKTools
|
|
||||||
* Method: getStringFromNDK
|
|
||||||
* Signature: ()Ljava/lang/String;
|
|
||||||
*/
|
|
||||||
JNIEXPORT jstring JNICALL Java_com_tt_ttutils_jni_NDKTools_getStringFromNDK
|
|
||||||
(JNIEnv *, jclass);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
2
app/src/main/jni/note.md
Normal file
2
app/src/main/jni/note.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#https://docs.qq.com/doc/DRE1yeVdvQ21vbm11
|
||||||
|
#https://www.jianshu.com/p/87ce6f565d37
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|||||||
Reference in New Issue
Block a user