jni方法签名不对的问题

This commit is contained in:
WangQiang 2022-08-04 10:32:08 +08:00
parent 8ae5b18fd0
commit c2b403a90c
7 changed files with 96 additions and 19 deletions

View File

@ -23,7 +23,7 @@ exports_files([
android_library(
name = "android_framework",
proguard_specs = [":proguard.pgcfg"],
visibility = ["//visibility:public"],
visibility = ["//visibility:public"],
exports = [
":android_core",
":android_framework_no_mff",

View File

@ -0,0 +1,38 @@
# Copyright 2019 The MediaPipe Authors.
#
# 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.
licenses(["notice"])
exports_files([
"proguard.pgcfg",
])
android_library(
name = "camera_framework",
proguard_specs = [":proguard.pgcfg"],
visibility = ["//visibility:public"],
exports = [
":camera_core",
],
)
android_library(
name = "camera_core",
srcs = glob(
["**/*.java"],
),
deps = [
"@maven//:com_google_guava_guava",
],
)

View File

@ -0,0 +1,29 @@
# Additional flags to pass to Proguard when processing a binary that uses
# MediaPipe.
# Keep public members of our public interfaces. This also prevents the
# obfuscation of the corresponding methods in classes implementing them,
# such as implementations of PacketCallback#process.
-keep public interface com.google.mediapipe.framework.* {
public *;
}
# This method is invoked by native code.
-keep public class com.google.mediapipe.framework.Packet {
public static *** create(***);
public long getNativeHandle();
public void release();
}
# This method is invoked by native code.
-keep public class com.google.mediapipe.framework.PacketCreator {
*** releaseWithSyncToken(...);
}
# This method is invoked by native code.
-keep public class com.google.mediapipe.framework.MediaPipeException {
<init>(int, byte[]);
}
# Required to use PacketCreator#createProto
-keep class com.google.mediapipe.framework.ProtoUtil$SerializedMessage { *; }

View File

@ -1,10 +1,17 @@
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_framework")
licenses(["notice"])
package(
default_visibility = ["//visibility:public"],
features = ["no_layering_check"],
)
alias(
name = "olarender_jni",
actual = ":olarender",
)
cc_library(
name = "olarender",
srcs = [

View File

@ -9,10 +9,12 @@ load("@build_bazel_rules_android//android:rules.bzl", "android_binary", "android
def ola_aar(name,
srcs = [],
assets = [],
gen_lib = True,
proguard_specs = [],
assets_dir = "" ):
_ola_jni(
gen_lib = gen_lib,
name = name + "_jni",
)
@ -46,16 +48,17 @@ EOF
def _ola_jni(name):
def _ola_jni(gen_lib, name):
# native.cc_binary(
# name = "libola_render_jni.so",
# linkshared = 1,
# linkstatic = 1,
# deps = [
# "//mediapipe/render/module/render_queue:olarender_jni",
# ]
# )
if gen_lib:
native.cc_binary(
name = "libola_render_jni.so",
linkshared = 1,
linkstatic = 1,
deps = [
"//mediapipe/render/module/render_queue:olarender",
]
)
native.cc_library(
name = name + "_cc_lib",

View File

@ -1,12 +1,14 @@
load("//mediapipe/render/module/render_queue:ola_aar.bzl", "ola_aar")
licenses(["notice"])
package(default_visibility = ["//visibility:public"])
cc_binary(
name = "libola_render_jni.so",
linkshared = 1,
linkstatic = 1,
srcs = [
deps = [
"//mediapipe/render/module/render_queue:olarender",
],
)
@ -28,11 +30,9 @@ cc_library(
ola_aar(
name = "render",
# srcs = [
# "RenderJni.java"
# ],
name = "ola_render",
srcs = glob(["*.java"]),
gen_lib = False,
proguard_specs = ["proguard.pgcfg"],
# deps = [
# "//mediapipe/render/module/render_queue:olarender",

View File

@ -15,16 +15,16 @@ public class RenderJni{
System.loadLibrary("ola_render_jni");
}
public static native Long create();
public static native long create();
public static native int render(
Long renderContext,
long renderContext,
int textureId,
int width,
int height,
Long timestamp,
long timestamp,
boolean export
);
public static native void release(Long render);
public static native void release(long render);
}