提交 97152007 authored 作者: 史晓晨's avatar 史晓晨

适配flutter3.38(.aar问题待处理)

上级 5dc8add1
group 'com.aliyun.face.aliyun_face_plugin'
version '1.0'
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.0'
}
}
rootProject.allprojects {
repositories {
google()
mavenCentral()
flatDir {
dirs 'libs'
}
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 31
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 18
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// 实人认证SDK
implementation(name: 'aliyun-base-2.3.25.4.241012105837', ext: 'aar')
implementation(name: 'aliyun-facade-2.3.25.4.241012105837', ext: 'aar')
implementation(name: 'aliyun-face-2.3.25.4.241012105837', ext: 'aar')
implementation(name: 'aliyun-faceaudio-2.3.25.4.241012105837', ext: 'aar')
implementation(name: 'aliyun-facelanguage-2.3.25.4.241012105837', ext: 'aar')
implementation(name: 'aliyun-facequality-2.3.25.4.241012105837', ext: 'aar')
implementation(name: 'aliyun-nfc-2.3.25.4.241012105837', ext: 'aar')
implementation(name: 'aliyun-ocr-2.3.25.4.241012105837', ext: 'aar')
implementation(name: 'aliyun-photinus-2.3.25.4.241012105837', ext: 'aar')
implementation(name: 'aliyun-wishverify-2.3.25.4.241012105837', ext: 'aar')
implementation(name: 'Android-AliyunFaceGuard-10052', ext: 'aar')
implementation(name: 'APSecuritySDK-deepSec-7.0.1.20240528.jiagu', ext: 'aar')
// implementation(name: 'aliyun-facelanguage-v2.1.2-20221027112723', ext: 'aar')
// implementation(name: 'aliyun-ocr-v2.1.2-20221027112723', ext: 'aar')
// implementation(name: 'aliyun-photinus-v2.1.2-20221027112723', ext: 'aar')
// implementation(name: 'aliyun-wishverify-v2.1.2-20221027112723', ext: 'aar')
// implementation(name: 'Android-AliyunFaceGuard-10033', ext: 'aar')
// implementation(name: 'APSecuritySDK-DeepSec-7.0.1.20220813.jiagu', ext: 'aar')
// 实人认证三方依赖库
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.squareup.okio:okio:1.14.0'
implementation 'com.alibaba:fastjson:1.2.83_noneautotype'
implementation 'com.aliyun.dpa:oss-android-sdk:2.9.11'
}
group = "com.aliyun.face.aliyun_face_plugin"
version = "1.0"
allprojects {
repositories {
google()
mavenCentral()
}
}
val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
rootProject.layout.buildDirectory.value(newBuildDir)
subprojects {
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
project.layout.buildDirectory.value(newSubprojectBuildDir)
}
subprojects {
project.evaluationDependsOn(":app")
}
plugins {
id("com.android.library")
id("kotlin-android")
}
android {
namespace = "com.aliyun.face.aliyun_face_plugin"
compileSdk = flutter.compileSdkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
defaultConfig {
minSdk = flutter.minSdkVersion
}
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
// 实人认证SDK
implementation(files("libs/aliyun-base-2.3.25.4.241012105837.aar"))
implementation(files("libs/aliyun-facade-2.3.25.4.241012105837.aar"))
implementation(files("libs/aliyun-face-2.3.25.4.241012105837.aar"))
implementation(files("libs/aliyun-faceaudio-2.3.25.4.241012105837.aar"))
implementation(files("libs/aliyun-facelanguage-2.3.25.4.241012105837.aar"))
implementation(files("libs/aliyun-facequality-2.3.25.4.241012105837.aar"))
implementation(files("libs/aliyun-nfc-2.3.25.4.241012105837.aar"))
implementation(files("libs/aliyun-ocr-2.3.25.4.241012105837.aar"))
implementation(files("libs/aliyun-photinus-2.3.25.4.241012105837.aar"))
implementation(files("libs/aliyun-wishverify-2.3.25.4.241012105837.aar"))
implementation(files("libs/Android-AliyunFaceGuard-10052.aar"))
implementation(files("libs/APSecuritySDK-deepSec-7.0.1.20240528.jiagu.aar"))
// implementation(name: "aliyun-facelanguage-v2.1.2-20221027112723", ext: "aar")
// implementation(name: "aliyun-ocr-v2.1.2-20221027112723", ext: "aar")
// implementation(name: "aliyun-photinus-v2.1.2-20221027112723", ext: "aar")
// implementation(name: "aliyun-wishverify-v2.1.2-20221027112723", ext: "aar")
// implementation(name: "Android-AliyunFaceGuard-10033", ext: "aar")
// implementation(name: "APSecuritySDK-DeepSec-7.0.1.20220813.jiagu", ext: "aar")
// 实人认证三方依赖库
implementation("com.squareup.okhttp3:okhttp:3.11.0")
implementation("com.squareup.okio:okio:1.14.0")
implementation("com.alibaba:fastjson:1.2.83_noneautotype")
implementation("com.aliyun.dpa:oss-android-sdk:2.9.11")
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.aliyun.face.aliyun_face_plugin">
</manifest>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"></manifest>
package com.aliyun.face.aliyun_face_plugin;
import androidx.annotation.NonNull;
import java.util.HashMap;
import java.util.Map;
import android.content.Context;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.MethodCall;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.Log;
import com.alipay.face.api.ZIMCallback;
import com.alipay.face.api.ZIMFacade;
import com.alipay.face.api.ZIMFacadeBuilder;
import com.alipay.face.api.ZIMResponse;
/** AliyunFacePlugin */
public class AliyunFacePlugin implements FlutterPlugin, MethodCallHandler {
/// The MethodChannel that will the communication between Flutter and native Android
///
/// This local reference serves to register the plugin with the Flutter Engine and unregister it
/// when the Flutter Engine is detached from the Activity
private MethodChannel channel;
private Context mContext;
private static String TAG = "AliyunFace";
@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding flutterPluginBinding) {
channel = new MethodChannel(flutterPluginBinding.getBinaryMessenger(), "aliyun_face_plugin");
channel.setMethodCallHandler(this);
mContext = flutterPluginBinding.getApplicationContext();
}
@Override
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
if (call.method.equals("getPlatformVersion")) {
result.success("android " + android.os.Build.VERSION.RELEASE);
} else if (call.method.equals("init")) {
Log.d(TAG, "enter init.");
ZIMFacade.install(mContext);
} else if (call.method.equals("getMetaInfos")) {
Log.d(TAG, "enter getMetaInfos.");
String metaInfo = ZIMFacade.getMetaInfos(mContext);
result.success(metaInfo);
} else if (call.method.equals("verify")) {
Log.d(TAG, "enter verify.");
Map<String, String> params = call.arguments();
String certifyId = params.get("certifyId");
String useVideo = params.get("ext_params_key_use_video");
HashMap<String, String> extParams=new HashMap<>();
if (useVideo.equals("1")){
extParams.put("ext_params_key_use_video","true");
}
if (certifyId == null || certifyId.isEmpty()) {
Log.e(TAG, "certifyId is null");
return;
}
ZIMFacade zimFacade = ZIMFacadeBuilder.create(mContext);
zimFacade.verify(certifyId, false,extParams, new ZIMCallback() {
@Override
public boolean response(ZIMResponse response) {
if (null != response && 1000 == response.code) {
Log.d(TAG, "face verify success.");
} else {
Log.e(TAG, "face verify error.");
}
result.success(response.code + "," + response.reason);
return true;
}
});
} else {
result.notImplemented();
}
}
@Override
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
channel.setMethodCallHandler(null);
}
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
namespace "com.aliyun.face.aliyun_face_plugin_example"
compileSdkVersion 33
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.aliyun.face.aliyun_face_plugin_example"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 21
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
plugins {
id("com.android.application")
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}
android {
namespace = "com.aliyun.face.aliyun_face_plugin_example"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "com.aliyun.face.aliyun_face_plugin_example"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug")
}
}
}
flutter {
source = "../.."
}
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
flatDir {
dirs project(':aliyun_face_plugin').file('libs')
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
allprojects {
repositories {
google()
mavenCentral()
flatDir {
dirs(project(":aliyun_face_plugin").file("libs"))
}
}
}
val newBuildDir: Directory =
rootProject.layout.buildDirectory
.dir("../../build")
.get()
rootProject.layout.buildDirectory.value(newBuildDir)
subprojects {
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
project.layout.buildDirectory.value(newSubprojectBuildDir)
}
subprojects {
project.evaluationDependsOn(":app")
}
tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx2048M
android.useAndroidX=true
android.enableJetifier=true
......@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
\ No newline at end of file
include ':app'
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
pluginManagement {
val flutterSdkPath =
run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.11.1" apply false
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
}
include(":app")
......@@ -10,7 +10,7 @@ environment:
dependencies:
flutter:
sdk: flutter
plugin_platform_interface: ^2.0.2
plugin_platform_interface: ^2.1.8
dev_dependencies:
flutter_test:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论