[Q] Native Binary #include compilation question - General Questions and Answers

Edit:
See my previous thread.
http://forum.xda-developers.com/showthread.php?t=1365199

Related

How to load native library in Android

Can someone give advice in how to load native library and make native function calls in android application? I tried with android 1.0 and my result is below:
Result:
1. I added the following code to android application Lunarlander.java
//native method declaration
native void hello(String name);
static {
System.out.println("libhello.so loaded");
System.load("/data/app/libhello.so");
}
I added my libhellp.so to lunalander.apk and then uploaded the apk to /data/app. The application launches ok.
2. I added the following code to android application Lunarlander.java
//native method declaration
native void hello(String name);
static {
System.out.println("libhello.so loaded");
System.load("/data/app/libhello.so");
}
…
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
…
//test loading hello lib and call hello function
LunarLander myLunarLander = new LunarLander();
myLunarLander.hello("Hi there!");
…
}
I added my libhellp.so to lunalander.apk and then uploaded the apk to /data/app. The application launches was forced to close and the error message is “The application Lunar lander has stopped unexpectedly. Please try again”.
Not sure why it failed to invoke the native function.
Thanks,
SynPad
Please post Questions in the Q&A section. Dev and Hacking Section is for contributers (new programs themes ect)
I'll go ahead and have the thread moved to Q&A for you this time
Thanks for your cooperation,
Joel
Q&A Section Team
EDIT: you may also want to try the g1 section, pm me if you would like it moved there instead.
Check the samples w/ NDK
BTW, do you know how to ship the lib along the apk :
there is a "native library location:" entry on project settings in eclipse plugin
Later

[Q] Build Environment for Infuse 4G SGH-I997 Development

Hi all,
Does anyone have a best method to do this? Here's what I'd guess so far:
* First, determine the proprietary bits and back them up via some method. (TODO: how?)
* Pull the AOSP repo: http://android.git.kernel.org/
* Super-impose the Samsung OS sources from SGH-I997_OpenSource.zip
* Type make at the project root, hope it builds.
* Roll up into a deployable image (TODO: howto deploy to target?)
On a related note - is there an emu for the Galaxy S family?
Thanks in advance for any tips.
Best wishes,
J
jhwilliams,
I encourage you to continue on this path to setting up a build environment and doing some kernel work. however, i believe a best step is to first get a "fix it / reset" button first (aka. Odin flashable package to flash to stock). That is where we are currently resting.
Thanks,
h8
jhwilliams said:
Hi all,
Does anyone have a best method to do this? Here's what I'd guess so far:
* First, determine the proprietary bits and back them up via some method. (TODO: how?)
* Pull the AOSP repo: http://android.git.kernel.org/
* Super-impose the Samsung OS sources from SGH-I997_OpenSource.zip
* Type make at the project root, hope it builds.
* Roll up into a deployable image (TODO: howto deploy to target?)
On a related note - is there an emu for the Galaxy S family?
Thanks in advance for any tips.
Best wishes,
J
Click to expand...
Click to collapse

[Completed] [Q] Kernel Building

Hi everybody
I need some help on kernel building.
After a quick documentation I understood that to customize kernel i need sources corresponding to my smartphone model (sources that must be public if I am not mistaken).
Now I have the misfortune of working with a Virtual V501 smartphone. I hope someone knows because i can't find any documentation on the internet.
Thus I can't get the kernel source for this smartphone, and I wonder if there are alternative solutions for modding the kernel or to obtain sources.
The purpose of this modding is the addition of libusbhost library, which I've noticed to be present in system / lib. But if i try to connect an external device via OTG cable it doesn't work properly.
Hi there!
There's many generic kernel building codes on XDA, I search and found too many.
Here's a good generic one...
http://forum.xda-developers.com/showthread.php?t=2486098
Without source for your device, which there's no mention of on XDA, it will be difficult I bet.
There's nothing more XDA assist can do to help I'm afraid, we're here to point people in the right direction, if there is one...on XDA only. You may need to look around elsewhere for your source!
Good luck. ?
---------- Post added at 10:51 AM ---------- Previous post was at 10:50 AM ----------
Also, you could ask more questions in the thread I linked, or similar ones.

[Q&A] {MIRO/TIPO/J/E}[CM10] Riches Kernel [0.6.2]

Q&A for {MIRO/TIPO/J/E}[CM10] Riches Kernel [0.6.2]
Some developers prefer that questions remain separate from their main development thread to help keep things organized. Placing your question within this thread will increase its chances of being answered by a member of the community or by the developer.
Before posting, please use the forum search and read through the discussion thread for {MIRO/TIPO/J/E}[CM10] Riches Kernel [0.6.2]. If you can't find an answer, post it here, being sure to give as much information as possible (firmware version, steps to reproduce, logcat if available) so that you can get help.
Thanks for understanding and for helping to keep XDA neat and tidy!
Code:
#include <std_disclaimer.h>
/*
* Your warranty is now void.
* You are making these modifications to your phone
* I accept no responsibility of the consequences, if any for flashing this kernel
*/
Kernel 0.6.2-riches for CM10 Sony XPeria Jlo. THIS AND ONLY THIS
Compiled using Linaro android toolchain 4.9-2014.10.
No changes made for source, this is just compilation using new compiler. Source code the same as in Joebonriche github.
Recompressed ramdisk (Originaly compresed using "gzip", recompressed using "gzip -9" witch should speedup bootime by few miliseconds and decerased image size be few kB).
I want to this boot.img be as close to oryginal release as possible so not new tweaks. if it is faster/slower than oryginal then all thanks to new android-toollchain.
Download from
Code:
1drv.ms/1qycutK
Future plans ?
New kernel release for CM10 Xperia Jlo with LZ4 support (form zswap), some "debloat" from unused code (smaller means alwas faster). and maybe more.
A humble suggestion to developers
For somebody like us who unintentionally clear system partition and lose both rom and stock or custom recovery it would be really nice if there were custom recovery in image file. We can boot phone in fastboot mode and flash custom recovery so that we can reflash stock rom that we have backed up. I learnt it the hard way when i wiped system partition and lost custom recovery in xperia miro. Thank you for all you wonderful guys out there.

[Kernel] [6.0.1] Unofficial M.A.D. mod Kernel from Verevka - JiaYu S3

M.A.D. mod Kernel by Verevka
Custom Kernel created by Verevka for JiaYu S3 for MarshMallow ROMs.
Based on https://github.com/MediatekAndroidDevelopers source code.
This project is closed - dev has sold his phone.
Code:
#include
/*
* Your warranty is now void.
*
* We aren't responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this Kernel
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at us for messing up your device, we will laugh at you.
*/
Description:
This is custom Kernel created by Verevka for JiaYu S3 for MarshMallows ROMs.
This Kernel is based on https://github.com/MediatekAndroidDevelopers source code.
Features:
Added exfat & f2fs support;
Probably battery drop is fixed;
Linero 5.3;
Other features from Verevka's Kernel for Android 5.1
Bugs:
Hall sensor isn't working.
Installation instructions:
Flash via SP Flash Tools: CM13 version for CyanogenMod 13 by M.A.D Team, AICP version for AICP11 by M.A.D Team.
Download:
Take a look at Downloads section next to Discuss.
Author:
Verevka
M.A.D Team:
superdragonpt, DerTeufel1980, fire855
Kernel version: Linux 3.10.101
ROM Firmware Required: Android 6.0.1 from M.A.D Team installed, custom recovery installed
XDA:DevDB Information
M.A.D. mod Kernel, Kernel for the JiaYu S3
Contributors
Borizzz, Verevka
Source Code: https://bitbucket.org/Verevka/android_kernel_jiayu_s3_h560
Kernel Special Features: Includes exfat, f2fs support and others changes
Version Information
Status: Abandoned
Current Beta Version: Initial release
Beta Release Date: 2016-08-02
Created 2016-08-02
Last Updated 2016-08-03
Reserved
Reserved
Reserved for Dev.Purposes
Where can i find the download link? Sorry
pleasetouchmenot said:
Where can i find the download link? Sorry
Click to expand...
Click to collapse
Just like in CM/AICP/AOSPA threads - take a look at Downloads section next to Discuss/Screenshots.
Borizzz said:
Just like in CM/AICP/AOSPA threads - take a look at Downloads section next to Discuss/Screenshots.
Click to expand...
Click to collapse
Got it now. Thankyou
Please post source code. Else thread is going to be closed
Regarding special kernel features... Exfat, f2fs... It's totally useless because this is integrated on rom side (fuse - Filesystem in userspace) already. And kernel implementation is not even been used, although being present, if one does not force initramfs to use it (which breaks adoptable storage).
The M.A.D. Team
DerTeufel1980 said:
Please post source code. Else thread is going to be closed
Regarding special kernel features... Exfat, f2fs... It's totally useless because this is integrated on rom side (fuse - Filesystem in userspace) already. And kernel implementation is not even been used, although bring present, if one does not force initramfs to use it (which breaks adoptable storage).
The M.A.D. Team
Click to expand...
Click to collapse
Why you may be 2 years to spread the firmware and the kernel without the source code, and I can not? I'm not ready to shell out possibly a month.
We were not allowed by jiayu China.
You forked our gpl kernel. Yours has to be gpl as well because of this.
The M.A.D. Team
hi, how about twrp that also supports and read f2fs?
When I put the kernel to 5.1, Report response was exactly the same. Why you are allowed to upload 5.1 without source, but I do not? Double standards? =)
(When I uploaded my kernel 5.1 on the forum moderator said, too, that you why he will not say the same about the 5.1? Double standards? =) )
---------- Post added at 12:00 PM ---------- Previous post was at 11:45 AM ----------
He opened the source code in the cap threads.
---------- Post added at 12:06 PM ---------- Previous post was at 12:00 PM ----------
My work is over for this phone! Maybe we meet with someone on the forums Vernee Apallo Lite. Goodbye!
Hopefully with DerTeufel1980 I have not meet !!!
Goodby!
Also, we never released any kernel on xda, because we were not allowed to. Some people are just too stupid to read xda rules.
If you are going to release vernee kernel without sources, your thread gets closed as well.
Edit: which work is over? You didn't do a thing... [emoji30]
The M.A.D. Team
Just my sources for 5.1- https://bitbucket.org/Verevka/android_kernel_h560
Verevka said:
Just my sources for 5.1- https://bitbucket.org/Verevka/android_kernel_h560
Click to expand...
Click to collapse
So, why don't you just release the new sources? No one prohibited you to base your kernel on top of ours. Just release sources, or keep it away of xda
The M.A.D. Team
what is difference i dont understand i think that 2 kernel are the same
All work, efforts and contributions offered to the community as volunteers should be thankful and appreciated by all. @DerTeufel1980 , your attitude and the way you respond to @Verevka is not adequate. It seems presumptuous, arrogant, poor, uneducated and even disrespectful and insulting. Please, you should apologize
---------- Post added at 03:02 PM ---------- Previous post was at 02:59 PM ----------
Thanks you for this work @Verevka ......
You do a lot to help make bigger and enrich this community. Thank you very very much
My first post was like: please add source code. His answer was like &!%!
I don't need to apologize for anything. If he does not want to share his kernel source, based off our open source kernel, he can go wherever he wants to, but not xda... He just should go there quickly
The M.A.D. Team
Verevka said:
When I put the kernel to 5.1, Report response was exactly the same. Why you are allowed to upload 5.1 without source, but I do not? Double standards? =)
(When I uploaded my kernel 5.1 on the forum moderator said, too, that you why he will not say the same about the 5.1? Double standards? =) )
---------- Post added at 12:00 PM ---------- Previous post was at 11:45 AM ----------
He opened the source code in the cap threads.
---------- Post added at 12:06 PM ---------- Previous post was at 12:00 PM ----------
My work is over for this phone! Maybe we meet with someone on the forums Vernee Apallo Lite. Goodbye!
Hopefully with DerTeufel1980 I have not meet !!!
Click to expand...
Click to collapse
Do not stop working on this smartphone. Do not give up, do not kneel. Thanks to your work is no longer only a single mode of development. thanks to your work this community is great. I appreciate your work ..... I appreciate the work of all developers: Portuguese, Russian, German, Spanish, Italian, Chinese and all countries of the world
---------- Post added at 03:16 PM ---------- Previous post was at 03:12 PM ----------
DerTeufel1980 said:
My first post was like: please add source code. His answer was like &!%!
I don't need to apologize for anything. If he does not want to share his kernel source, based off our open source kernel, he can go wherever he wants to, but not xda... He just should go there quickly
The M.A.D. Team
Click to expand...
Click to collapse
I have great sorrow and sadness after reading your words in this post.
:crying:
antonioantuan said:
All work, efforts and contributions offered to the community as volunteers should be thankful and appreciated by all. @DerTeufel1980 , your attitude and the way you respond to @Verevka is not adequate. It seems presumptuous, arrogant, poor, uneducated and even disrespectful and insulting. Please, you should apologize
---------- Post added at 03:02 PM ---------- Previous post was at 02:59 PM ----------
Thanks you for this work @Verevka ......
You do a lot to help make bigger and enrich this community. Thank you very very much
Click to expand...
Click to collapse
Actually he was simply stating what XDA rules demand for development threads ...
Also he was actually helping out the guy when he said his "commits " of adding exfat and all on kernel is useless .
Xfat,and this file systems...are not mandated by kernel , but at user level ...
Verevka seems not to understand very well MediaTek environment
( understandable, we all need to learn at some point ), he was actually helping the guy out.
The "rudeness" was simply a legitimate statement if we look at :
- XDA rules concerning GPL, and development threads.
- And, GPL rules and code of conduct , how to use commits, rebasing on an outside sources , cherry-picking, keeping git credits , and keep a git history.
This are all terms that you are most likely not familiar with
( understandable your not a kernel developer )
But its something that verevka will sooner or later must embrace, and follow this rules on future works like vernee, or simply on community based works .
His first reply was due to lack of verevka's source. Since there was only a link to M.A.D. repo of github, that did not reflect the source used on this kernel...
Our GPL is up, enyone is free to use it, and PLEASE USE IT.
But there's guidelines to follow...
Cheers

Categories

Resources