Android ant override location of res folder using build.properties - android

So I am setting up my project to use ant to do automated builds but with one of the external libaries I have run into an issue. The external libary src and res folder point to another projects res and src folder (using LinkedResources in eclipse to do this). So the build fails when building this project because it cannot find the res folder. I made it find the src folder by overriding the source.dir in ant.properties to point to the path of the src folder. I tried to the same by using resource.dir but it does not work. Is there any way to do this ?

You can change the res location using the property resource.absolute.dir. The default value is res.

Related

assets folder missing in LibGDX project

I need to add some files to my android/assets folder of my project however, it isn't there ? I may have accidentally deleted it without knowing.
how do I create the assets folder?
Android studio doest provide ASSETS folder by default
you have to create it from
For the Android plugin, extra files and folders specific to Android:
AndroidManifest.xml
res/
assets/
aidl/
rs/
jni/
jniLibs/
Please read where to place asset folder

How to tell Eclipse that folder was moved

I have moved (the content of) the src folder of my Android project to src/main/java because I want to use gradle. So far no problem.
But then I moved the res folder to src/main/res because I want to use a different res folder in src/debug/res for my debug builds. Now Eclipse gives me that error:
ERROR: resource directory '/.../MyProject/res' does not exist
How can I tell Eclipse that the folder was moved? I already moved the folder back and then again to the new location using right-click -> Refactor -> Move. So Eclipse should know where the res folder is.

Android Studio: Inserting files into the Assets folder

I'm trying to copy and paste a whole bunch of files/folders into my Assets folder (that I created in the Main folder by selecting New > Folder > Assets Folder). But I get this error:
Cannot create class-file
The file in question is GUIDemo.class but there are others like it, too. Any suggestions how I can copy and paste the assets files into my project?
Android Studio uses Gradle-based build system, you should
putting assets/ inside of the source sets (e.g., src/main/assets/)
or create a folder under res
Try right click your app -- New -- Folder-- Assets folder
Change Android tag to Project, right click src --- make module app

Java folder in android project and the src is empty

I found a library on git. https://github.com/flavienlaurent/NotBoringActionBar
after imported to the eclipse, I noticed that the src folder is empty and there is a folder called java. Tried to run it anyway but it gave me an error.
Do I have to make some changes before running it?
The project you are trying to import is developed with Android studio, so there is some extra files in it.
To import it in your eclipse you need to import it as normal android project. now your src folder is empty and you have an extra folder named java
copy com package from java folder and paste it in src folder
Delete java and bin folder
Clean and build your project
Run on emulator or device
The Project you are trying to import is a project based on Gradle build system developed using Android Studio.
In such project everything related to code is in App/src/main
/java contains all .java files
/res same as res in eclipse
AndroidManifest.xml
So easiest solution is create a new project in eclipse and copy paste the file accordingly,
In you case
Copy the src/com directory in /src in eclipse
Copy the /res in to /res directory of created project
Replace AndroidManifest.xml
But it is strongly recommended to migrate from Eclipse to Android Studio instead of doing all these because now all the libraries available are migrating in to gradle.

Assets folder in android app (eclipse)

I had searched to create the assets folder in an android app, the solution which i had tried is <App Name>/src/assets/fonts/
but when i try to use a ttf file in my Application, i have an error :
the code :
mFace = Typeface.createFromAsset(mContext.getAssets(),"fonts/fontType.ttf");
and the error :
native typeface cannot be made
I don't know if the assets folder is in the good place.
The problem is at the path of asset
<App Name>/src/assets/fonts/
should be
<App Name>/assets/fonts/
Read more at Directory Structure of an Android Project
Android project directory structure is as below
In Android Studio, I tried the root "app" folder, and that didn't work. I looked for the AndroidManifest.xml file and put the assets folder there. That worked for me.
For me it ended up being app\src\main\assets
ProjectName/assets/fonts
Not in under the src.
The assets folder is an independent folder.
While creating an Android project itself the Assets folder is independent to the src folder. Not inside the src folder.
Confirm that assets folder was created in the following way /assets.
Later create a fonts folder inside the assets folder and place fonts file inside the fonts : /assets/fonts

Categories

Resources