Android build errors (porting to ICS) - android

I am working on porting from gb to ics in android
I have changed path of a particular folder and kept it at a different path
after build I get many errors stating that the files doesn't exist because those files are present in that folder which I have copied in a different path
How can I link my build and code to pick up my new path because in my Java files I just write import com.android, and not the actual entire path of the file.
How and where to mention the entire path of the folder?

Right click your project. Select Build Path -> Configure build path -> Java build path
Here you can specify the path of changed library.

Related

Copy folder structure containing binaries to native libraries folder

I want to copy and execute some precompiled binaries on device, the problem is that the relative folder structure needs to be the same as in the original package (I cannot move all binaries to root folder).
What so far I found about this is how to copy binaries without .so extension to lib folder here. It works as expected, once installed I can locate the binary using context.getApplicationInfo().nativeLibraryDir, however when I place the directory with binaries it cannot find it using the command.
Further investigation shows that folder does get coppied to apk. I can confirm that by unziping the apk and finding the binaries coppied at /lib/arm64-v8a/.
Now since the apk is fine, the next step I did is check what actually gets copied to device. This can be found in /data/app/app.name.com+random_hash/lib/ and I confirmed that folder does not get copied over, only binaries from root folder do.
What I want to know is whether the code responsible for copying native libraries is located on device and cannot be changed, or the application can be somehow configured to copy the folder structure?
Example repo: https://github.com/D4no0/copy_native_binaries
The code is on device, part of the OS :
"Subdirectory is not supported by the Android OS.
When the APK is installed, the .so libraries are extracted to a directory in the form of /data/app/your.app/lib/. That directory is added to the library path searched by System.loadLibrary so that it can be found. System.loadLibrary do not support a directory structure, thus, the .so files in a subdirectory under lib/ are not extracted."
The above answer is coming from a Googler working on Android, from the following issue :
https://issuetracker.google.com/issues/63707864#comment4
Cheers,
Jérôme

Android - How do I create the assets folder manually?

I'm new to Android development, and I'm trying to manage projects from the command line using the SDK since I cannot get Android Studio 1.2 to work properly in my system (it's unresponsive).
The problem: I created a new project but the asset folder is missing.
Other SO answers (enter link description here) solve this by creating the folder from the IDE, or by pointing to the asset folder in the .iml file, with doesn't work in my case (I trying to mange the projects from the command line entirely)
There's also a solution editing build.gradle, but the project created from command line (using the SDK) doesn't seem to be a gradle project.
Any help would be appreciated.
Just create a directory called "assets" at the root of your project, i.e. in the same directory your AndroidManifest.xml lives. There's no need to "link that folder from the project". At least that's the case on my system, where I'm using Android SDK 24.4.1 (and I'm not using Gradle -- just emacs and ant).
Once I had assets/fonts/aisauc.ttf in there, the following code...
import android.graphics.Typeface;
...
Typeface greek =
Typeface.createFromAsset(getAssets(), "fonts/aisauc.ttf");
mytextfield.setTypeface(greek);
gave me a TextField with characters from the font I wanted.
How do I create the assets folder manually?
You make it the same you make any directory on your filesystem. Whether you use mkdir or a command-line equivalent, or whether you use your desktop OS's file manager, is up to you.
The default location for an assets/ directory is in a sourceset (e.g., src/main/assets/, to go along with src/main/AndroidManifest.xml and src/main/res/ and src/main/java/, where src/main/ is a sourceset). You can have an assets/ directory located elsewhere, if you choose, but then you will need to configure your build.gradle file to teach Gradle the alternative assets/ location for whatever sourceset you are trying to apply it to.
In your left most sidebar or the sidebar that shows the app, manifests, java... etc, right click app > New > Folder (has the green android symbol next to it) > Assets Folder.
On the next screen leave the path as 'main' and click 'Finish'. Then you can drop whatever asset you want into the folder.

Android Studio: intermediates directory doesn't get populated

I'm using NDK on Android Studio 0.8.9. I've followed this guide where the author is using 0.5.1.
Following his tutorial, he's able to see the generated files into ./app/build/ndk/debug/lib (around time 3:42 in the video).
However, in my case I see there's an extra directory created by Android Studio, called intermediates. Although the NDK generated libraries are subdirectories of intermediates, I don't see them in my project structure. See image below:
This is the content of the intermediates directory itself (seen from an explorer view):
If I add a directory myself with, for instance, only a text file present, then I see that directory under the build directory in the Project structure.
Is there any filtering present that filters out binary files or something like this? Or what could cause this behaviour?

Change default output bin folder of Eclipse

Eclipse puts binaries in "project folder/bin/" by default. I'd like to have Eclipse put generated binaries etc in another folder (outside the project folder). Doing Android development.
You can change the "output folder" (by default bin) for a Java project (see "How do I change a Java project's bin folder in Eclipse?")
But for Android projects, as detailed in "Can't change default output folder", you need to modify the build.properties as well.
That can be dangerous though, as commented:
Just to note that changing the output folders doesn't work when dealing with library projects - there's part of the Ant script that is hardcoded to look in the bin folder of libs anyway.
So maybe using the exclude option of Dropbox is preferable here?
I would like to describe an approach below.
First, create a new empty project locally in eclipse work space for storing generated output files say output_bin.
As mentioned in above steps, now from Default Output Folder we need a new Variable to link to our project output folder.
Default Output Folder -> Browse -> Create New Folder...
-> Advance -> check "Link to folder in the file system" ->
Variables -> New.. -> Name = PROJECT_OUT, Location = "CHOOSE_PATH_TO\output_bin\bin\Project1bin" -> Ok
Note: Project1bin is a new directory which stores the bin folder. output_bin is an empty project and you can have multiple bin folder for various projects.

Updated Eclipse, cannot remove Jar

I deleted a jar from my libs file and now I cannot build the project and the jar will not go away.
I've tried cleaning the project, fixing the android properties now I'm stuck.
Has anyone else had this problem?
Description Resource Path Location Type
Archive for required library: 'C:/apps/APP/libs/imagecrop.jar' in project 'APP' cannot be read or is not a valid ZIP file APP Build path Build Path Problem
Solution.
Don't use clean or "fix project properties"
Simply right click on the project and press "Refresh"..
You need to remove it from your build path. Right click your project, go to Properties->Build Path. The build path contains four tabs:
The Java Build Path properties page contains four tabs:
Source. The source and output folders. If you initially create a project without separate source and output folders, you can change it here. Multiple source folders can be used in one project; e.g., to separate application source code from unit tests.
Projects. Check-off other projects in the workspace whose output folders should be added to this build path.
Libraries. Location of other archive files required by this project.
Order and Export. Order in which projects and libraries appear in the build path and the default runtime classpath; e.g., use classes from a workspace project before using the same classes from an archive library.
Go to libraries tab and remove the jar file you deleted.
Also refresh your project by right click -> Refresh so it will realize you deleted jar file.

Categories

Resources