Android error: missing method body, or declare abstract

48 views
Skip to first unread message

Martin Brown

unread,
Dec 9, 2016, 4:06:20 PM12/9/16
to NativeLibs4Java
I'm trying to run the Android example found in BridJ/Examples/AndroidExample. I am able to get dependencies resolved after downloading BridJ and using maven to build it successfully. I place the generated bridj-0.7.1-SNAPSHOT-andorid.jar in app/libs, and I place everything under BridJ/src/main/android-libs in app/src/main/jniLibs. I copy the files in BridJ/Examples/AndroidExample/ to my Android project. All of the BridJ dependences are resolved at compile time.


The problem is that MainActivity won't compile. The error on 

public static void helloLog(Pointer<Byte> logThis);

says "Missing method body, or declare abstract". I haven't added or removed anything from MainActivity.java, but FWIW I pasted the source for that below. Any ideas?


package yada.yada.yada;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;

import java.io.IOException;

import org.bridj.BridJ;
import org.bridj.NativeLibrary;
import org.bridj.Pointer;
import org.bridj.ann.Library;
import org.bridj.demangling.Demangler.Symbol;

import static org.bridj.Pointer.pointerToCString;

public class MainActivity extends Activity {

   
static final String TAG = MainActivity.class.getName();

   
@Library("example")
   
public static void helloLog(Pointer<Byte> logThis);

   
static {
       
BridJ.register();
   
}

   
@Override
    protected void onCreate(Bundle savedInstanceState) {
       
super.onCreate(savedInstanceState);
       
helloLog(pointerToCString("Hello, World!"));
       
try {
           
NativeLibrary lib = BridJ.getNativeLibrary("example");
           
for (Symbol s : lib.getSymbols()) {
               
String p = s.getParsedRef() + "";
               
System.out.println(p);
           
}
       
} catch (IOException e) {
           
throw new RuntimeException("BridJ loading failed?", e);
       
}
        setContentView
(R.layout.activity_main);
   
}
}


Reply all
Reply to author
Forward
0 new messages