我尝试在Android NDK上工作,我的第一次测试不是很确定,我需要帮助,因为我没有看到我的错误在哪里.
以下代码编译没有问题,但是当在模拟器上运行时,程序返回SIGSEGV信号,并且没有在logcat中显式写入错误.但是,会出现一条警告,指示未找到Java类.经过一天的研究,这一切看起来都是正确的.
这是我的Java代码:JNITestActivity.java
package com.test.jnitest;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class JNITestActivity extends Activity {
private static String LIB_NAME = "JNItest";
static {
System.loadLibrary(LIB_NAME);
}
public static native void javaCallJNI();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Log.i("onCreate", "Native function begining");
javaCallJNI();
Log.i("onCreate", "Native function ending");
}
void callFromCPP() {
Log.i("callFromCPP", "JNI can call JAVA !");
return ;
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的C++代码:testjni.cpp
#include <jni.h>
#include <android/log.h>
#define LOG_TAG "testjni"
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
extern "C" {
JNIEXPORT void …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用根据android文档的方法替换我的Espresso registerIdlingResources和unregisterIdlingResources弃用方法IdlingRegistry.
我的一些测试在更新之前工作,现在不再有效了......这些测试一起工作,但不能一起工作.
我注意到旧版本(Espresso类)有一点不同,这一行在IdlingRegistry课堂上不存在:
baseRegistry.sync(IdlingRegistry.getInstance().getResources(), IdlingRegistry.getInstance().getLoopers());
Run Code Online (Sandbox Code Playgroud)
我认为这个sync方法对我的自定义IdlingResource非常重要...
如何在没有这条线的情况下同步我的活套?
谢谢你的帮助.
编辑:我使用EspressoCore 3.0.1与runner/rules 1.0.1