小编Bhu*_*tap的帖子

没有JNI_OnLoad发现跳过init>应用程序关闭

伙计们,

我正在开发一个Android应用程序,我需要第三方.so库.我根据他们的指示构建了这个第三方库(使用ndk-build),然后将其包含在我的Android项目中.

因此,我按照docs/PREBUILTS.html中描述的步骤操作,并在jni/prebuilt目录中成功构建新的.so.现在我尝试在一个简单的测试Android应用程序中使用它来利用.so工具.所以我做的是:

static {
  Log.i("load so > ","load so");
  System.loadLibrary("xyz");
   }
/* The native functions */
private static native int openFile(String filename);

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    try{
        String path =  getPathForDownloadDirectoryFile();
        Log.i("file path> ", path);
        int num= openFile(path);
    }catch(Exception e){
        Log.e(">", "could not open the file");
    }
}
Run Code Online (Sandbox Code Playgroud)

现在,当我运行我的应用程序时,我收到一条调试消息:在/data/data/com.example.myfirstapp/lib/xyz.so 0x411e6738中找不到JNI_OnLoad,跳过init然后应用程序关闭.

有关详细信息,请参阅以下错误日志:

No JNI_OnLoad found in /data/data/com.example.mysecondapp/lib/xyz.so 0x411e67a0,   skipping init
W/dalvikvm(  570): No implementation found for native    Lcom/example/mysecondapp/MainActivity;.openFile:(Ljava/lang/String;)I
D/AndroidRuntime(  570): Shutting down VM
W/dalvikvm(  570): threadid=1: thread …
Run Code Online (Sandbox Code Playgroud)

java-native-interface android android-ndk

15
推荐指数
2
解决办法
3万
查看次数

从JBehave中的stext场景中自动生成候选步骤方法存根

我使用Jbehave作为我的BDD框架.我正在寻找一种从文本场景中自动生成候选步骤方法存根的方法

Given there is a flight
And there is a customer
When the customer books the flight
Then the customer is shown on the manifest
Run Code Online (Sandbox Code Playgroud)

像这样的Java:

<@> Given("there is a flight")
<a@> Pending
public void thereIsAFlight() {
}

<@> Given("there is a customer") // note 'Given', even though story line is 'And'
<@> Pending
public void thereIsACustomer() {
}

<@> When("the customer books the flight")
<@> Pending
public void theCustomerBooksTheFlight() {
}

<@> Then("the customer is shown on the flight …
Run Code Online (Sandbox Code Playgroud)

bdd jbehave

6
推荐指数
1
解决办法
2046
查看次数

JBehave在场景期间保持跨越给定/当/后的步骤的数据

我一直在尝试使用JBehave,我需要弄清楚在一个特定场景运行期间是否存在跨步骤维护数据的方法?我的意思是可以在给定/当/后的场景中维持状态/数据,而不使用步骤类下的任何状态变量.

bdd jbehave

6
推荐指数
1
解决办法
4574
查看次数

如何用Angular js做日常Javascript的东西?

在过去的3-4天里,我一直在研究Angular js.从它的外观(使用教程和视频)看起来非常直观.但是当我真正开始用Angular js替换我当前的Web应用程序代码时,我面临很多启动问题.

例如,如果在某个事件上我希望将一些HTML添加到DOM中某个已存在的元素,那么通过传统的jQuery路由,我只需获取元素并添加HTML.我无法理解如何使用Angular执行完全相同的操作,因为在Angular控制器中不建议使用DOM操作.所以我如何访问我应该扩展的元素.

另一个例子可能是我必须在某个时候重置一个Form元素.我再次面临在Angular控制器中使用jQuery样式元素选择器的困境.

有人可以向我解释如何用Angular做所有这些事情.

javascript javascript-framework angularjs

2
推荐指数
1
解决办法
721
查看次数