android studio not generating iml file? - java

hi i am android developer and i am getting some problem , usually i do not care about .iml file in project folder but my senior said me that i do not have .iml file in my project . i do not know what the usage of .iml file and how to use it .
but the main thing is that android studio is not generating .iml file for my any project . for example in other developers project , if project name is apple than there would be apple.iml in project folder but it is not happening in my case . i have also updated my Android Studio in hope that it would get fix but it didn't .
well , please help me how to fix this problem and also tell me what is the usage of .iml file in android projects

IML is a module file created by IntelliJ IDEA, an IDE used to develop Java applications. It stores information about a development module, which may be a Java, Plugin, Android, or Maven component; saves the module paths, dependencies, and other settings.
In case if an .iml file is not generated on your project, there
are two ways to do that,
First:
Go to Android Studio and open your project.
Go to Files
Select Sync Project with Gradle Files
Second:
Close your Android Studio
Go to your root project directory
Delete the .idea folder. If not visible you can check the hidden folders
Import the same project again.
This should re-generate your .iml files

To generate a new .iml file
You have to delete all the folder starting with the dot(.) like .idea, .dart_tool and pubspec.lock file
The project folder name should be all lowercase, with underscores to separate words, just_like_this.
Open your project in the Android Studio from terminal run this command flutter create --platforms=android .
This will generate just_like_this.iml file for you. If your package name is different then delete a new directory generated in your project file if needed.

Related

Android Studio : Could not set process working directory to "new directory"

I am doing a project using Android Studio. After change the directory to another place. I got an Error "Could not set process working directory to [my old directory path] : could not setcwd() (errno 2: No such file or directory)"
Follow below steps.
Close android studio.
Delete the .idea folder on your project folder.
Start android studio and open your project.
worked for me.
I solved it with Invalidate Caches / Restart
Restart Android studio and open your project from the new directory
It can be due to a number of reasons.
The solutions below are proven to solve it
Close android studio. Delete the .idea folder on your project folder.
On the menu File select Invalidate Caches and restart
Check if your project root folder has any invalid chars such as whitespace. If so, close Android Studio and rename the root folder.
This method working for me always
Invalid cache
Rebuild project
Delete the .idea folder on your project folder.
Sync project with gradle file.
But those all solution workes once after new restart of pc need to do again
Gradle and IntelliJ tend to confuse each other when you move project modules and dependencies around; there is no way to refactor cleanly.
This method helped me but do note that you will lose your local changes in change-list unless you save them
Delete all your .iml folders
Delete all your .gradle folders
Delete ~/.gradle/caches (or %UserProfile%/.gradle/caches on Windows)
Invalidate / Clear Cache & Restart
Open Project
Close IntelliJ / Android Studio Again
Open Project Again
For me the issue was a typo in the folder name.
In order for android studio to recognize a folder as a module, that folder must be included in the settings.gradle.kts at the root level. If either the folder or the include have a typo, then Android Studio will fail to recognize the module as such, and trying to run it will result in the aforementioned error.
Faulty sample:
Folder name: "desktop"
Include statement: include(":dekstop")
Fix:
Folder name: "desktop"
Include statement: include(":desktop")
I'll post the most embarrassing answer here.
I was running the Gradle commands from the wrong directory :).

How to Create a Java Project for Visual Studio Code

I have just transitioned into Visual Studio Code from Eclipse for Java. I want to create a simple HelloWorld folder which has src and bin folders. However, I do not know how to create the .classpath, .project, and .settings the same way Eclipse does it. How do I do this?
Hit Ctrl+Shift+P to show all commands, then type "Java" and select "Java: Create Java Project"
Visual Studio Code doesn´t have this orientation of creating a project because it´s file oriented. It´s on of the diferences with Visual Studio.
It means that creating a project structure is based on folders and files, and no file references and links the folders and files to a project.
If you want to create a project with src and bin folders, you´ve to do it manually.

Importing a jar into android

I'm trying to import a jar named Security.jar into an Android app that I'm currently working on, however, no matter what I do I cannot get AS to recognize the package that I'm importing. I pasted the jar into the libs folder that I created for the app and synced the gradle files, as well as modified the dependancies, all to no avail. If anyone sees ANYTHING that's wrong please let me know! Here's a link to some pictures pertaining to the issue.
http://imgur.com/a/sEoXi
error log build.gradle
I believe that you should do this:
compile files('libs/your.api.jar')
When you've pasted the jar file in the libs folder. Give it a shot.
A good way to add external JARs to your Android project or any Java project is:
right click on your project ..
then goto properties..
then click on java build path..
then click on libraries...
then click on add External JARs..
select jar file ..
click on ok

java.lang.UnsatisfiedLinkError: Couldn't load stlport_shared: findLibrary returned null (tess-two)

I am using sqlcipher.jar for encrypting database in android and also using it's native library in
libs/armeabi folder
1)libdatabase_sqlcipher.so
2)libsqlcipher_android.so
3)libstlport_shared.so
and
libs/x86 folder
1)libdatabase_sqlcipher.so
2)libsqlcipher_android.so
3)libstlport_shared.so
and jar file named sqlcipher.jar in libs/ folder all i have imported
now every thing is working fine it's going good database is fetching and reading from sqlite is also working fine and also i am not getting any kind of error in SQLiteDatabase.loadLibs(context); line
but i want to implement also OCR in my project to do that i am importing project named tess-two from this http://code.google.com/p/tesseract-ocr/ and https://github.com/rmtheis/tess-two in that there is a library named tess-two folder
and i am importing that project library into my android project and i cleaned my project and run it at that time i got the error in line SQLiteDatabase.loadLibs(context);
again when i removed tess-two library and doing uninstall from device and doing clean and build and run it's working fine no error is occurring, i want OCR functionality also in my project can anybody help me
I had same issue.. I was using Android Studio and I had imported application from eclipse to android studio.
I spent 3-4 hours to find out the solution.
Here what I did to solve this issue.. (Only for Android studio)
Create Directory into src folder name it main and other directory as per following image. You may have libs and assets folder outside of src folder, in main directory of project, that is eclipse structure. We will need to follow Android Studio's structure..
For more details.. Check this link...
For other helps regarding SqlCipher check this link..
(I know I am bit late to answer this question but it might help someone.)
I was running into the same issue. First of all, check that all the libraries are correctly imported.
In my case the problem was that when we added another library project, these project had a armeabi_v7 folder, so apparently if will take precedence over the armeabi folder, meaning that the sqlitecypher libraries won't be located.
In our case the solution was just to remove the armeabi_v7 folder on the new library.
Hope it helps.
You can try to change the line:
APP_STL := gnustl_static
(in the file tess-two / tess-two / jni / Application.mk)
to:
APP_STL := stlport_static
The loader is not able to find the said library file. So, I decided to pack it along with my app. It's only 394KB
I downloaded the libstlport_shared.so from the following address and added it to the lib/armeabi and lib/armeabi-v7a folders, cleaned the project and rebuilt it. Now it runs without a problem.
http://331312256.wodemo.net/browse/dl/156348/lib/armeabi/libstlport_shared.so?resolved=1
Hope that helps

How to open Android source code in Eclipse ADT

I am new to Android development and I have downloaded Source code of Cameraapp from Google web site from following locaiton:
https://android.googlesource.com/platform/packages/apps/Camera
I am trying to build and compile it into the Eclipse ADT environment. However when I open the folder using File> Import> Android> select existing project, I do not see the folder being able to be selected as a project.
I also noticed that there is no Android Manifest file inside this folder. How is this possible?
I read somewhere that camera app does not have its own Android Manifest file but it uses manifest file from the Gallery App. Which may be right. But my question is that how can I even compile this application?
Or would I have to compile the entire android application folder? Hopefully that is not the case.
If you do not have manifest file in the project then you have no option than to create an empty android project and copy the corresponding res/ and src/ file to your empty project.
Then modify your manifest file to define your activities and permissions. Then you can build and run your project in your ADT workspace.

Categories

Resources