I mostly destroyed my android studio project by accident, and in trying to rebuild it, I've come to a point where the project won't run because it can't find my MainActivity - a java file - because the AndroidManifest.xml throws an error saying 'cannot resolve symbol MainActivity'. edit: I know where this file is located, it's in the src directory, but android studio doesn't seem to know that, so can't start the MainActivity.
Where is the path to these files set? ie, where does a module look for it's own java files? It doesn't seem to be in the Android facet section, that's only the paths to resources and assets, libraries and the manifest file, but that's the sort of thing I'm looking for.
Thanks!
Right-click on your myproject folder > Mark as Directory > Source Root
I had the same problem. The cause for me was that I'd imported a source file from a different project and the package specifier at the top of the .java file was wrong:
package com.example.android.opengl;
Instead it should have referred to my current project.
Related
I'm having trouble linking some files to my project. It's an android studio project and I want to link one external file: "Emv_lib.so" (I know that are some questions on how to link .so files, but those are about internal .so files, this is an external one.)
Beside this file, I have an emv_lib.lib and emvIIapi.h (the header file that actually contains the functions that i need to call). I cannot get this to work. I tried with CMakeList, putting the emvIIapi.h file in there, but it comes with the error: "Execution failed for task ':app:configureCMakeDebug'.
C/C++"
I follow some suggestion, to create in src/main the folder jniLibs and put your .so files in there, but it didn't work.
From my undestanding, I have to compile, somehow, either the .so files or the .lib file.
I'm new to android studio, so don't go hard on me. Thank you for your time!
I am following the steps mentioned here: https://priyankvex.wordpress.com/2015/08/30/how-to-build-tesseract-ocr-library-for-android-studio/
Step 3 tells to copy and paste the tess-two folder to my Project but when I paste, I get an error stating Cannot create class-file and none of my `.java' files get copied.
Where am I going wrong?
I don't know what the problem is but it works, if you copy the folder directly into the project folder instead of copying through the Android Studio.
Maybe for some reason the files are not copied in the Android Studio.
It is because some .class files are included in your copy files.
Some IDE will not include .class file in project and show this tips.
I was working on my app, editing and coding some xml and layouts when suddenly I got an error on my libs folder. It's very weird because I haven't actually modified or changed any base classes or something. Moreover, I just noticed I lost also my R.java file and all of the references are gone.
What possibly can be the problem? I tried to clean+build the project but it didn't work.
Here is a screenshot of my eclipse:
http://i.gyazo.com/959040321d1fd6d00ee0b9a90133aa9c.png
Place the jar in the root folder of your project. Then you can add it to your classpath . (you cannot place a jar and access it using android.R)
You can add the jars to your build path by right clicking on your project->properties and going to Build Path. Then you can add an external jar
I am trying to implement Google Analytics in my android app for that I need to import one library. when I am trying to import that library it shows one error like
Could not write file: C:\Documents and Settings\ignite054\Desktop\i\Version
4\Project\PashuPalan\.classpath.
C:\Documents and Settings\ignite054\Desktop\i\Version 4\Project\PashuPalan\.classpath
(Access is denied)
How to solve this? please help me.
First copy the jar file from the android-sdk\extras\google\analytics_sdk_v2\libGoogleAnalytics.jar and add it into your projects libs folder.
The try to add library libGoogleAnalytics.jar to build path (in libs right click on libGoogleAnalytics.jar -> BuildPAth -> Add to Build Path).
Do not add anything in Manifest file and in your java file use Ctrl+Shift+O to automatically organize your imports.
Make sure that the directory and file is still there.
And, take a look that C:\Documents and Settings\ignite054\Desktop\i\Version
4\Project\PashuPalan is a valid path, has a .classpath file and it is readable.
Maybe .classpath file is hidden, removing the hidden attribute may resolve the issue.
Hey I'm having a pretty basic problem importing classes into my Eclipse based Android app. I have included the class directory into the /src directory where I figured the classes would be easily included, but Eclipse is saying it "cannot resolve the classes".
One thing I noticed is that the project folder that I included and the subfolders are just regular folder and not package folder icons. Is that a problem? If so, how do I change them to packages? This is an external git repo, so I'd rather not do anything beyond just including them in my project.
Here are some pics of how I set up the project to help:
The Activity where the error is:
Here is the package structure in the project, and the package called "android-utils" where the files I'm trying to import live:
Here is how I'm importing the files:
Btw, these classes are just some utils and I'll be improving and adding to them during the development process.
Let me know if you need any in more info to help me get these files imported the right way. Thanks!
Did you try dragging the .java files from Windows Explorer directly onto the package in Eclipse you want to put the new classes into? It should then ask to copy or link to files.
As your folder contains only java files Add them as Jar File in your Buildpath project, and your problem will be solved.
Also your jar file you can put it under the /libs folder
see this link to lean how you create jar file