How to solve this : 'Running android lint' issue - android

In any activity of my project, if i do some changes and then save that activity i got the message "Running android lint has encountered a problem."
This is the my error log :
java.lang.NullPointerException
at com.android.ide.eclipse.adt.AdtUtils.workspacePathToFile(AdtUtils.java:466)
at com.android.ide.eclipse.adt.internal.lint.EclipseLintClient.getClassPath(EclipseLintClient.java:753)
at com.android.tools.lint.client.api.LintClient.getJavaClassFolders(LintClient.java:198)
at com.android.tools.lint.detector.api.Project.getJavaClassFolders(Project.java:270)
at com.android.tools.lint.client.api.LintDriver.checkIndividualClassFiles(LintDriver.java:977)
at com.android.tools.lint.client.api.LintDriver.checkClasses(LintDriver.java:920)
at com.android.tools.lint.client.api.LintDriver.runFileDetectors(LintDriver.java:785)
at com.android.tools.lint.client.api.LintDriver.checkProject(LintDriver.java:661)
at com.android.tools.lint.client.api.LintDriver.analyze(LintDriver.java:288)
at com.android.ide.eclipse.adt.internal.lint.LintJob.run(LintJob.java:151)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)\
I don't to know how to solve this.

The following steps helped me to solve the same issue.
On My Project -> Context Menu -> Android Tools -> Fix Project Properties
Changing to latest version in AndroidManifest.xml
android:targetSdkVersion="21"
Maybe just one of them is enough :).

In Window > Preferences > Android > Lint Error Checking; Uncheck "When saving files check for errors".
I hope it will helps you

However, the root cause here is some sort of invalid project definition -- one or more of the class path entries are pointing to a resource which can't be opened; for example, you might have a classpath reference which is relative to a class path variable, and the class path variable is no longer pointing to an absolute location.
The above CL will simply make sure that lint doesn't throw an exception in this scenario, but it won't be able to do actually include the given reference.
You'll want to look at the project properties dialog and make sure all the build paths and resources are correct -- and that's the workaround until this issue is integrated

What worked for me was to open the "appcompat_v7" project on my Package explorer. I had closed it before and forgot to open so I got the same problem as OP. Now it's all fixed

Here is another solution, just tested it.
Go to Project properties -> Java and set compiler change Compiler compliance level: to 1.7.
If this is not working then try Project properties -> Android switch from what ever it is using to android 4.4.2.

In my particular case, the problem was caused by conflicting key bindings.
Check .metadata/.log in your project folder for hints.

Why this Error?
It seems that its something related to appcompat_v7 library that we have in our package Explorer. If you are working with API (targetSdkVersion) level 21 you would not face this issue.
For Mac OS X Operating System :
Go to Menu : Eclipse -> Preferences -> Android -> Lint Error Checking and Un-Check : "When saving files, check for errors"
For Windows Operating System :
Go to Menu : Window -> Preferences -> Android -> Lint Error Checking and Un-Check : "When saving files, check for errors"
You may find this post helpful : http://code2care.org/pages/solution-running-android-lint-has-encountered-a-problem-nullpointerexception-error/

Related

How to add new activity to existing project in Android Studio - "Project not ready"

What needs to be done to add a new activity to existing project that works and compiles but has "Project not ready" in the menu. Please see the picture.
Other than that all works, so I don't know what IDE means by "Project not ready"
This is a little bit over a year but i thought i would provide an answer for anyone (novice like me) who may encounter the same problem.
I had the exact same problem as depicted and denoted. It was fixed by
Cleaning the project (Build --> Clean Project)
Sync with Gradle ( Tools --> Android --> Sync project with Gradle files)
What I did to solve this was to open up specifically the Android project in a new Android studio instance (not from the flutter project, which has everything)
Note if you don't see the option to do this in your project -> flutter options
Then you can just open the folder containing the project, followed by opening up the Android project specifically from there.
Now you should get the options
(Not an exact answer) Observation:
I don't know exactly what happened, but it works now, all I could notice is that gradle had some error from unclean build likely I must have had some code changes resulting in invisible compilation errors. After good build menus available again.
Please post your "observation" if you don't know exact answer.
Thanks
If you want to add a Activity to an android application,
you have to Extend Activity from one of your classes like this:
public class SecondActivity extends Activity
And add that activity to your manifest.
<activity
android:name=".ActivitySecondClass"
android:label="#string/app_name2" >
</activity>
You have to give the project time to build first. Wait a minute or two before jumping in.
I had the same issue. I fixed it by clearing the cache. (File > Invalidate caches & Restart).

unable to instantiate application - ClassNotFoundException

EDIT: This problem has not already been resolved in the other suggested SO question
I had a fully working app on the market for over a year, with very few crash reports. Then recently I changed my app into a library, so that it could be included within multiple different "wrapper" projects. This was so that I could easily make different version - free, paid, non-google markets, with/without in-app purchasing etc etc.
The new "library+wrapper" app appeared to work fine. I could run it multiple times, without error. But then a day later (when presumably the OS had closed some or all of the app's activities) I tried to run it and it reported
Unable to instantiate application com.mycompany.mygamelibrary.MyGameApplicationClass: java.lang.ClassNotFoundException: com.mycompany.mygamelibrary.MyGameApplicationClass
The class it failed to find is the first class that runs when the program starts up, MyGameApplicationClass - which extends Application. This class is part of the library.
I suspect something goofy in one of the two manifest files.
The manifest of the wrapper project contains the lines...
<application android:icon="#drawable/mygame_icon"
android:screenOrientation="portrait" android:label="My Game Name"
android:name="com.mycompany.mygamelibrary.MyGameApplicationClass">
Any ideas what could have gone wrong?
EDIT: The library was referenced "the correct way" as defined by yorkw's answer to this SO question.
EDIT: I can not repeat the crash at the moment :-( I don't know what it is the OS does when the app is not used for a day or two.
There are two possibilities. Either you, like me, have a spelling error in your manifest file. Have a co-worker or friend read it to make sure the name is correct. Or you have not referenced the project correctly.
The official document describes how to properly link projects in its documentation.
Why it would first seem to work and later stop working is a bit of a mystery. However, I guess that the VM might still have had the necessary references ready to resolve the classes in the library just fine. A restart of the VM removed all those references and trying to resolve them was unsuccessful.
Update: Regarding the edits in the OP: As you confirm that you have correctly referenced the other project, you can check if the project is included in APK, just to be sure. You can rename and open an APK as any other archive (.rar works fine for me). Sometimes, it happened to me, the project is not correctly included in the APK. A cleaning of your workspace usually remedies the problem and so could a restart of your IDE depending on what you are using. To manually conduct a clean in Eclipse for example, use Project->Clean... or try Android Tools->Fix Project Properties by right-clicking on your project.
As you seem to also have fixed the problem by restarting your device, it could be that the libraries were linked incorrectly. A problem that I have never seen myself but as a very common quote says: "Have you tried turning it off and on again?".
For Android Studio:
Build --> Clean Project
Fixed issue.
Have you tried to make a new subclass of MyGameApplicationClass in your 'main' project and set it in the manifest as Application class?
I had a slew of bugs with Android Studio 3.0 Canary 4 and the way I fixed them was by editing the AndroidManifest.xml by adding in some jibberish to the application name. Then, I clicked build. Obviously, a whole mess of new error messages appeared. I changed the name back to what it should be, built the app, and it just ran.
Sometimes, I just don't know...
EDIT: Just ran into this issue on Android Studio 3.0 Canary 4 on my laptop when switching over. I again went through the same process of changing AndroidManifest.xml file to contain a typo, building, and changing back. That didn't work.
I then noticed that instant run was still enabled. Going into settings (by clicking command + , (comma key)) and typing "instant run", I was able to disable instant run, built the app, and the error of class not found went away.
Summary of Steps to Fix [FOR ME]
Invalidate cache / restart
Clean the project
Manually delete the build folder (need to be in project view for this one)
Make an intentionally errant edit to your AndroidManifest.xml file, build the app, observe the errors, remove the errant edit and build again
Disable instant run
Again, I don't mean to insinuate that this will fix everyone's error, but I have now used some combination of these steps on two different machines (MacOS Sierra) and it has been resolved for me. Hope it helps.
In my case, application id and package were mismatched. This should be same as presented in following images...
AndroidManifest.xml
app/build.gradle
In this case you can see, applicationId and package both are same that is com.mycompany.mygamelibrary
May be its a Build Path Configuration problem.I did the following to solve the issue.
1.Right click on your project and go to Java Build Path.
2.Click on Order and Export tab.
3.Check Android Private Libraries and other 3rd part libraries if you have added.
4.Press ok and clean the project.
I hope it will solve the issue.
Once I had the same error message, but maybe the cause isn't the same.
I did a code and worked for a while, then I wanted to improve it and got the same error and I couldn't run it.
I could fix the problem with
the correct Build Path order (as I can see you've already did this)
I check on the Order and Export tab the android-suppor-v4.jar
and the key was the Android SDK Managert->Upgrade everything and (next) Eclipse->Help->Check for updates.
After I upgraded to the latest android plugin and SDK my app compiled and ran again.
I hope this will help you!
I'm not very sure about this but it might be that your system's debug.keystore license validity has expired as it is valid for only 365 days. You just need to delete the debug.keystore from your computer. The debug.keystore will be generated automatically by Eclipse when you compile your Android App.
Same message seen ... this time it turned out to be different output folders for MyApp/gen and MyApp/src in the Build Path (caused by Maven integration).
Unchecking "Allow output folders for source folders" solved the problem.
I had this issue in an Android application that needed an Application class which was created in wrong path inside the Android Studio project. When I moved the class file to the correct package, it was fixed.
This all Process work for me to solve application class Exception.
Step 1: Open Run(window+R) Search -> Prefetch Remove all file (Some file not Delete)
Step 2: Open Run(window+R) Search -> %temp% Remove all file (Some File not Delete)
Step 3: Open Android Studio -> Build -> Clean Project
OR
Select File > Invalidate Caches / Restart > Invalidate and Restart from Android Studio toolbar.
OR
Close and reopen Android project.
OR
Restart System
I ran into this issue several times and both times it seemed to be caused by some instant run feature.
In my case, deleting the application from the device and then installing it from Android Studio again resolved the issue.
I ran into this problem today. The project runs well for over a year but today it reports this issue, and cannot debug on my testing device.
I fixed it by updating to latest gradle version. Hope this can solve your problem.

Fatal Lint Error during exporting of signed app

I'm trying to export a signed android app, but I encountered this lint error:
And when I go into the xml to look at it, this happens:
Is there a way to solve this so that I can continue to sign the app? I don't need them translated since it'll all be in English anyway.
The problem was with Android Lint. For solving this go to Preferences -> Android -> Lint error Checking.
There you can see a list of error checking methods.
Scroll to Correctness:Messages.
Change the severity of Missing Translation to be something other
than error, say warning
Window--> Preferences --> Android -->Lint Error Checking --> Uncheck the second check box that says -Run full error check.
Hope this helps...
Since you don't want to translate on all languages and errors similar to that try the following step
Project -> Properties, find Android Lint Preferences, in top to right click Configure Workspace Settings... -> Uncheck Run full error check when exporting app.

Unable to load Facebook SDK to Eclipse. Build Path Error

So I have not been able to even start coding for the app I want to build, I am having a really hard time getting the SDK set up for me to code based on it.
Here is what I did:
Downloaded Eclipse
Downloaded the JDK, Android SDK, and ADT on Eclipse.
Created a directory named "Facebook", where I cloned: https: //github.com/facebook/facebook-android-sdk .git (Separated to avoid the spam mechanisim :P)
Created a new project from existing source; please note that on the tutorials it reads "Create project from existing source" as an option within the "New Android Project" workflow, but my Eclipse only has "Android Project From Existing Code" (see: http://db.tt/gOmutx08 and that is what I used) as a separate workflow. Also, there is no "New Android Project" here, only a new "Android Application Project" and this does not prompt me to select an existing project as source (see: http://db.tt/usuzcTxS ). Not sure if this is where the problem is coming from.
Created a new project, and added the SDK project we created previously as a reference library.
The problem must definitely be on step number 4 as I get the following errors on my Eclipse Problems logger:
a) Description Resource Path Location Type
The container 'Android Dependencies' references non existing library 'F:\Users\Desktop_1\Android\Facebook SDK\facebook-android-sdk\facebook\bin\facebook.jar' Test-Facebook Build path Build Path Problem
b) Description Resource Path Location Type
The method onClick(View) of type new View.OnClickListener(){} must override a superclass method FbDialog.java /facebook/src/com/facebook/android line 101 Java Problem
c) Description Resource Path Location Type
The method onServiceConnected(ComponentName, IBinder) of type Facebook.TokenRefreshServiceConnection must override a superclass method Facebook.java /facebook/src/com/facebook/android line 575 Java Problem
d) Description Resource Path Location Type
The method onServiceDisconnected(ComponentName) of type Facebook.TokenRefreshServiceConnection must override a superclass method Facebook.java /facebook/src/com/facebook/android line 581 Java Problem
e) Description Resource Path Location Type
The project cannot be built until build path errors are resolved Test-Facebook Unknown Java Problem
Where the main problems are a and e, as the project cannot be built if there is an issue with the build path. Problems b through d can easily be fixed by removing the "#override" annotation from all three lines; however, I am not sure this is the actual fix because the SDK should have no issues in the first place, and removing the annotation may not make it work in the end.
Any ideas as to what I could try? I have already deleted the whole SDK download, and recloned the repository several times, even on different folders. Not sure anymore, and I am not sure why the screenshot from the tutorial looks way different than my eclipse. My guess is that the tutorial is slightly outdated as it still uses Froyo as a target :P
Any help is appreciated.
I had faced most issues you faced. I had it resolved.
Eclipse for some reason chose to keep facebook project is Java 1.5 eventhough my eclipse preferences had the setting to use Java compiler 1.6.
So, go to Project Properties in facebook project and select the java compiler to be 1.6. This solved my problem. Hope it solves yours too.
I've repeated Your steps and found out the following:
Seems Yours facebook project is not library one. Please, ensure that under facebook project Android properties 'Is Library' is checked (this should remove a and e errors);
Create project from existing source == Android Project From Existing Code
I think you have downloaded newer version of Android SDK - API Level 16 - Jelly Bean..
Before API level 16 , we had an option for Create project fron existing source , now it has been changed.
So if you wanna use Project from particular location you can use Android Project From Existing Code..
Also after creating Project make facebook source as library project...

Conversion to Dalvik format failed with error 1 with javax/net/SocketFactory.class

Encounter this problem when trying to Build Project getting such output in console:
[2010-07-19 23:29:23 - myProject]
trouble processing "javax/net/SocketFactory.class":
[2010-07-19 23:29:23 - myProject]
Attempt to include a core VM class in something other than a core library.
It is likely that you have attempted to include the core library from a desktop
virtual machine into an application, which will most assuredly not work. If
you really intend to build a core library -- which is only appropriate as
part of creating a full virtual machine binary, as opposed to compiling an
application -- then use the "--core-library" option to suppress this error
message. If you go ahead and use "--core-library" but are in fact building
an application, then please be aware that your build will still fail at some
point; you will simply be denied the pleasure of reading this helpful error
message.
[2010-07-19 23:29:23 - myProject] 1 error; aborting
[2010-07-19 23:29:23 - myProject] Conversion to Dalvik format failed with error 1
I was looking for my project to use the package javax, not found, clean all also does not help. what I am doing wrong?
Update
Sorry guys, but I could not find good fix for that, I want to emphasize the fact, that i dont use SocketFactory class in my project at all! source code was not changed before this problem, and that's why i think that problem in eclipse or adt or something else, BUT if i use ant(generated by sdk) to build this project there is no problem!!!
I solve this problem by removing Eclipse, Android SDK, Eclipse workspace, and just reinstall them, after this all works fine for now.
Hope this will help someone.
I had the same problem..
This worked for me
project-->properties->java build path->libraries-> remove all including android jars
now go the project browser, right click on the project you are working on,
then android tools---> fix project properties...
do a clean and then build...
I solved the problem (at least for me).
Here's what I did:
Go to Project » Properties » Java Build Path » Libraries
Remove all except the "Android X.Y" click OK.
Go to Project » Clean » Clean projects selected below » select your project and click OK.
That did the trick for me.
Hope it works for you as well
Update: well actually I might have to retract my opinion.. the actions removed the error messages but now I am missing certain classes and methods... arggghhhh
I just restarted Eclipse, and the error didn't appear anymore!
I had the same problem,and solved it as follows:
First clean all jars; (This problem must because your some jars)
Delete the project;
Reimport project;
Make sure your sdk is right, and project select one sdk version;
(This is my issue to solve the problem) Right click your project, and select "build-path", next select "add Librarys", and add your private jars;
clean-build, the problem has fixed;
I just had the same problem and I tried all of the solutions listed here with no success (I was starting to get annoyed). Then I removed the project from the workspace and then imported it again, and there were no problems!
This happened to me this way,
I have a quite an old project which I had to start working again today. I use 'Universal Image Downloader' library for basically every project where I have to deal with lots of images. So in this old project I had the source files of 'Universal Image Downloader' included to it's 'src' path. Back then I was a newbie and slowly I started developing my own library which could handle every day simple Android development tasks very easily. Obviously I included the 'Universal Image Downloader' to this.
After dusting off the old project today the first thing I did was to reference my library to speed up the development process but as I was trying to debug I ran into the "Conversion to Dalvik format failed with error 1" over and over again. First I thought it was the support library but even after clearing all libraries and adding only mine and doing a quick 'Fix project properties' I still got it. After trying various solutions I noticed this in the console "java.lang.IllegalArgumentException: already added: Lcom/nostra13/universalimageloader/cache/disc/BaseDiscCache;"
It was as simple as that... I'm trying to compile a class which has already been compiled.
Solution : I just simply removed all the class files I got from 'Universal Image Downloader' library from the 'src' directory. Since my library references "Universal Image Downloader" library the old project started working just fine.
Hit same problem shown on your log when trying to run an example project which was imported into eclipse.
Additional Info: in eclipse's Problems View I see the following error:
"The project cannot be built until build path errors are resolved"
In my case the imported project find the libraries just right(by just right I mean I can see the external path to each of the android libs in this case 2 libs, android.jar and maps.jar). So no shuffling of libs in my case, but might be your problem.
I followed Spock's suggestion of cleaning the project which I had to clean multiple times until it somehow resolve its issues. After, issue was solved I had to specify an AVD for the project to run and soon after was up and running on the emulator. Also, note that my eclipse is set up to Build Automatically.
In my case I'm not missing any class files or anything after the clean as the build is properly generating them.
Regards!
I was getting the same error. My problem was that i had an android device hooked up to debug with. As soon as I unplugged it I was able to export.
The answer I found was checking the source and library build path in the project's properties. Most likely there will be a duplicate as in something being referenced in both the source and library tabs. So delete the extra in the source tab and then clean the project and you should be good to go.
Either:
javax.net.SocketLibrary is in your source code, or
javax.net.SocketLibrary is included in a JAR file in your project
Under certain conditions it gets its knickers in a twist and the best fix I've found is to remove referenced jars, clean, add them back in and then compile again.
I believe the error can be caused by including the same classes twice.
This error will also occur (and you won't be able to get rid of it by cleaning) when using classes that are not part of the Android environment.
To summarise the information in the link bimbim.in provided (well my understanding when I glanced over it)
The Android Davik VM tries to compile the jars but finds some stuff that it can't compile to .dex files
so
Just create a "lib" directory in the root of the project (where the src, bin res directories are) and add them to the build path. Project Properties... Java Build Path... Libraries.. Add JARs..
I could resolve this issue by creating a new project, looks like the some project settings were creating this issue and could not really find the root cause for that. But, dumping the existing source code onto the new project resovled this issue. If anyone has found the root cause for this problem pls do let me know.
I had the same problem and solved it as follows:
- Go to Project/Properties/Java Build Path/Libraries and remove all JARs except Android
- Do a project clean
- Add the JARs again as External JARs (first time I added them internally, so that might be the problem)
After that the error was gone.
I solved the problem by updating available packages in the Android SDK et AVD manager. No need to remove Eclipse.
Whenever the Project is having the ambitious data. This problem is caused. May be android can't able to find which one choose.
From what I understand, this same cryptic error could be caused from a wide variety of reasons. I've got "Conversion to Dalvik format failed with error 1" error too. In my case the problem was that for some reason Project -> Properties -> Java Compiler was not set to "Enable project specific settings" with proper Java 1.5 settings, but was left to defaults instead (1.6 in my case). Debug, build and test on devices/emulators worked fine, but export always failed with the above error message.
If unsure about the proper settings, create the same project on some alternative location and just copy all needed files from the old project into the new one. This fixed the issue for me.
The next problem with the same error message came from using proguard. Updating to the latest version by replacing the one that came with android sdk, fixed that.
Hope this helps
My problem was having a jar file in my src folder. Removing jars from the build path works, but only if you don't need the jar in question. For people who need the jar in question, make sure that your jar file is not in the project folder (maybe just src subtree, but I would keep it separate to test). Put it on your desktop or something and try the "Add external jar.." option. Be sure to remove the jar from the project filesystem before adding another external. Having both is what causes the problem.
I have done it as the instruction of the first answer and it works.(Linux)
I think the problem may caused by SDK or ADT updates.
I do have to clear all the lib in Java Building path and then use android tools to fix the project. After cleaning and rebuild, it works as before.

Categories

Resources