Native Java Dosyalarını Anroid' De Kullanma
-
Java native de kodlanmış, sınıflar var elimde.
.java uzantılı, bunları .jar yaptım command prompt dan ama android projesine kütüphaneyi ekleyince
java.lang.UnsatisfiedLinkError: Native method not found: kdu_jni.Jp2_family_src.Native_init_class:()V
diye hata veriyor. Bu dosyaları android için nasıl çağırabilirim?
O dosyalardan birinin için ;
package kdu_jni;
public class Ads_params extends Kdu_params {
static {
System.loadLibrary("kdu_jni");
Native_init_class();
}
private static native void Native_init_class();
protected Ads_params(long ptr) {
super(ptr);
}
public native void Native_destroy();
public void finalize() {
if ((_native_ptr & 1) != 0)
{ // Resource created and not donated
Native_destroy();
}
}
private static native long Native_create();
public Ads_params() {
this(Native_create());
}
}
-
her jar ı kafana göre ekleyemezsin hocam, sırf java ile yazıldı diye hepsini kullanabileceğin anlamına gelmez bu. yaptığım android uygulamalarına bazı jar dosyalarını import edebilmiştim ama bazıları edilmiyor, senin aldığın tarzda hatalar alıyordum, bunun sebebi de android sdk in bunları desteklememesi.
lakin bir trick var :)
https://groups.google.com/forum/#!msg/adt-dev/nQobKd2Gl_8/Z5yWAvCh4h4J
bazen çalışabiliyor bu :) dene bakalım
kolay gelsin
-
unbalanced bunu yazdı
her jar ı kafana göre ekleyemezsin hocam, sırf java ile yazıldı diye hepsini kullanabileceğin anlamına gelmez bu. yaptığım android uygulamalarına bazı jar dosyalarını import edebilmiştim ama bazıları edilmiyor, senin aldığın tarzda hatalar alıyordum, bunun sebebi de android sdk in bunları desteklememesi.
lakin bir trick var :)
https://groups.google.com/forum/#!msg/adt-dev/nQobKd2Gl_8/Z5yWAvCh4h4J
bazen çalışabiliyor bu :) dene bakalım
kolay gelsin
Hocam biliyorum her jar' ı derlemediğini de. Ben de bunların .dll ve header file' ları da.
Android' de çalıştırılabildiği iddia ediliyor, ama nasıl import edilebilir bunu merak ediyorum aslında, verdiğin linke de bakıyorum şimdi inşallah olur :)
-
ozgunlu bunu yazdı
Hocam biliyorum her jar' ı derlemediğini de. Ben de bunların .dll ve header file' ları da.
Android' de çalıştırılabildiği iddia ediliyor, ama nasıl import edilebilir bunu merak ediyorum aslında, verdiğin linke de bakıyorum şimdi inşallah olur :)
hocam sende native kod varsa onu bi derlemen gerekiyor sanırım şuraya bi uğra direk native kodu projene dahil edemiyorsun
http://code.tutsplus.com/tutorials/ndk-tutorial--mobile-2152
-
detCode bunu yazdıozgunlu bunu yazdı
Hocam biliyorum her jar' ı derlemediğini de. Ben de bunların .dll ve header file' ları da.
Android' de çalıştırılabildiği iddia ediliyor, ama nasıl import edilebilir bunu merak ediyorum aslında, verdiğin linke de bakıyorum şimdi inşallah olur :)
hocam sende native kod varsa onu bi derlemen gerekiyor sanırım şuraya bi uğra direk native kodu projene dahil edemiyorsun
http://code.tutsplus.com/tutorials/ndk-tutorial--mobile-2152
hocam arkadaşın sorunu java ile, ndk dediğin c/cpp kodudur.. farklı şeyler yani bunlar..
-
ben direk kullaniyorum java native. ama path e verip kullandirtmiyor. bu native izin vermem tarzi bir seyler diyordu sanki.
javax'di tam olarak kullandigim.
direk javadan eklemedi diye ben de java dan source kodunu alip ekledim. compile ederken aglayacak ama onu belirteyim su hatayi verecek.
Error Code: 1 Output: trouble processing "javax/xml/ws/WebServiceRef.class": Ill-advised or mistaken usage of a core class (java.* or javax.*) when not building a core library. This is often due to inadvertently including a core library file in your application's project, when using an IDE (such as Eclipse). If you are sure you're not intentionally defining a core class, then this is the most likely explanation of what's going on. However, you might actually be trying to define a class in a core namespace, the source of which you may have taken, for example, from a non-Android virtual machine project. This will most assuredly not work. At a minimum, it jeopardizes the compatibility of your app with future versions of the platform. It is also often of questionable legality. If you really intend to build a core library -- which is only appropriate as part of creating a full virtual machine distribution, as opposed to compiling an application -- then use the "--core-library" option to suppress this error message. If you go ahead and use "--core-library" but are in fact building an application, then be forewarned that your application will still fail to build or run, at some point. Please be prepared for angry customers who find, for example, that your application ceases to function once they upgrade their operating system. You will be to blame for this problem. If you are legitimately using some code that happens to be in a core package, then the easiest safe alternative you have is to repackage that code. That is, move the classes in question into your own package namespace. This means that they will never be in conflict with core system classes. JarJar is a tool that may help you in this endeavor. If you find that you cannot do this, then that is an indication that the path you are on will ultimately lead to pain, suffering, grief, and lamentation. 1 error; aborting
bunu da cozebilmek icin sdk icindeki /tools/build.xml e girip
dx diye arat ve o kismi tamamen
<exec executable="${dx}" failonerror="true"> <arg value="--dex" /> <arg value="--verbose" /> <arg value="--no-strict" /> <arg value="--core-library" /> <arg value="--output=${intermediate.dex.file}" /> <arg path="${out.dex.input.absolute.dir}" /> <arg path="${jar.libs.absolute.dir}" /> </exec>
ile degistir. hatasiz compile edebilirsin bu islemler sonunda. bu kismi kaydet bir yere cunku yarin projeyi falan tasirsan bu olmadan compile edemezsin haberin ola.