android studio doesn't link to missing resources - android

So I had a bunch of resources in my app I swapped them out for new resources with different names, I now need to go through my project find all the missing resources references and change them to point to the new ones, android studio used to tell you where these were, you could simply try to build the project android studio would give a bunch of errors with links, and I could select each link to take me to the errors and fix them, but after updating studio it just gives me a failed linking resources error and i have to sift through myself, I'm sure there will be another way to do this perhaps through lint, does anyone have any information on how I could achieve this quickly

ok so I was right that lint checking can handle this for me analyze>inspect code> whole project and it gives me the errors with links

Related

Android Studio IDE exception can't open Layout Resources xml files

Android studio is throwing an null pointer exception related to the Android Support plugin when opening. As a result I can't open layout resources xml files.
I've tried
Invalidating Caches/ and restart
Cleaning/rebuilding project
Disabling Android SDK support plugin
Any help would be appreciated.Stack trace is below.
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(String.java:658)
at com.android.ide.common.resources.FileResourceNameValidator.getErrorTextForNameWithoutExtension(FileResourceNameValidator.java:135)
at com.android.ide.common.resources.FileResourceNameValidator.getErrorTextForFileResource(FileResourceNameValidator.java:117)
at com.android.ide.common.resources.FileResourceNameValidator.validate(FileResourceNameValidator.java:48)
...
Based on your answer, I think you should make sure you have every files in your project directories. Try to debug buy going to Analyze --> Inspect Code
and let it run for a while. Any errors will be marked as red. Check it if one of the files have missing references like your case above. More can be found here,
https://developer.android.com/studio/write/lint#studio and;
How Do We Configure Android Studio to Run Its Lint on Every Build?

Attempting to transfer my android app to gradle, having some issues with building

I'm attempting to transfer my app, Rymate Notes, from an imported IntelliJ project in Android Studio to a proper full blown gradle project. In order to make sure the new project folder is reasonably clean, I've decided to do it manually by copyin the source files and resources into a new folder.
Everything was going well until I decided to try and compile, and it doesn't compile.
The error I'm getting is https://gist.github.com/rymate1234/7896787
I have no idea what is causing this error, so any help is appreciated.
UPDATE - I have no idea https://gist.github.com/rymate1234/7896787#file-output2-log
You're hitting bug https://code.google.com/p/android/issues/detail?id=42752 where the AAPT tool (which is what does resource packaging in the Android build) crashes on certain types of errors. The culprit I've heard of is comment #5 in that bug, where a menu.xml file references a nonexistent string.

Project 'HelloFacebookSample' is missing required Java project 'facebook'

I have been following the instructions for integrating the facebook SDK into my apps. I have succeeded in getting all the given sample apps to compile and run except for "helloFacebookSample". For this I get a compilation error:
Project 'HelloFacebookSample' is missing required Java project 'facebook'
My understanding of projects/libraries/build paths etc is a little hazy, but I can not work out why this should fail where all the others succeeded.
Here's a screen grab of my properties window for HelloFacebookSample:
I can confirm that the directory:
c:\android stuff\facebook\facebook-android-sdk-3.0\facebook\bin
contains a file facebooksdk.jar
Any ideas?
EDIT: Thrashing around some more, I just clicked on the "projects" tab that you see in the screen grab above, and saw that it says "facebook (missing)". I'm a bit confused because I thought that projects may need to rely on libraries rather than other projects... but still I have no idea how to resolve the problem. I don't seem to have a project called simply "facebook"...
Edit: thrashing around some more, I just experimentally deleted the "facebook (missing)" from the java build path and then did an "add" of "FacebookSDK"... I thought this was cluttching at straws, but to my surprise it worked!!! HelloFacebookSample compiled and ran!!! - I have no idea what's going on though and would still like an explanation.
The previous version of the Android Facebook SDK referred to the project as 'facebook'. It looks like this sample was not updated to delete the old reference, and add the new one to 'FacebookSDK'. You took the corrective steps to resolve this yourself already by modifying the Java Build Path of the project.
The problem will easily be removed by simply going to the properties of your project and right clicking it, then go to project tab, select the project which prompts missing and remove it.
Now click on project->build project->clean
Now run your project and it will surely do fine

Android Settings project

I am trying to setup an android Settings project on eclipse. I got it from the tablet manufaturer. So I need to setup that project on eclipse and need to make some changes to the settings. When I get this project into eclipse then i am getting some compilation errors as follows:
code is looking for this class android.os.SystemProperties,R.xml.accessibilitySettings
Please let me know how to compile this project properly.
Thanks
If you get errors like this, press Ctrl+ Shift + O in order to update the packages automatically.
Sometimes, you might have to add strings in res directory, in separate xml file called strings.xml
Try running simple examples from android samples package for better understanding

Can't import or create new project from samples or downloads on Android/Eclipse

Basically, I need help importing downloaded source or creating a project from sample source programs. I'm looking for step by step instructions for both if anyone can point me there or post the steps.
I'm very new to Android/Eclipse. I have the environments installed and have successfully written a very minor app that works on the emulator and my real Droid X. I cannot, however, get any of the Android samples into a project without errors. I've tried importing, creating from existing source, and etcetera and it's all a mess with errors everywhere.
I have, however, successfully created a new empty project, then brought the components into the project one at a time typing or pasting in code for every file. I'd hover over and import Android and other components as needed. The WiktionarySimple, for example, ran with only a couple of changes and several warnings that I left alone. (I had to add 'formatted="false" in the statements below...)
<string name="template_user_agent" formatted="false">"%s/%s (Linux; Android)"</string>
<string name="template_wotd_title" formatted="false">"Wiktionary:Word of the day/%s %s"</string>
But there has to be an easier way to import! I've done the intuitive and I've followed instructions that I've found, but to no avail. Can anyone give me a complete list as to how to import or create a project from existing source or from source I've downloaded from the web?
Step #1: Start a new Android project
Step #2: In the first page of the Android project wizard, choose the "Create project from existing source" radio button, then click the Browse button and find the directory containing the project
Step #3: Tweak settings to suit, then press Finish
Step #4: If needed (not sure if it is anymore), right-click over the project name, and choose Build Path > Configure Build Path from the context menu, and make sure the Android entry in the checklist is checked
Its quite possible that you are not importing these projects incorrectly and that you are simply running into common problems that occur when importing projects.
For instance your problem involving adding formatted="false" is quite common and due to a change in the strictness of aapt, which is explained in this question. It is likely that the sample project was created before the change and has not been updated since.
That error involving the formatted="false" can also cause many more errors, since any xml after that error is often not parsed and thus any resources declared after it are not known. So the error No resource found that matches the given name (at 'hint' with value '#string/search_hint') and others like it are often due to the formatted="false" error. I would suggest fixing all the % sign errors with the formatted="false" then letting it rebuild and see how many errors are left.
As for the String types not allowed (at 'layout_width' with value 'match_parent') a quick search on stackoverflow says that its caused because FILL_PARENT was replaced with MATCH_PARENT in Android 2.2. So you need to set your sdk for the project to be Android 2.2 or higher. Here is the link to that question as well.
This happened to me in importing the wiktionary sample and i found the solution.
Import the project through existing code
Right click project and choose properties
In 'Android' Tab the default choice is the minimum API. Changed it to the latest(highest API)
Click ok.
Clean and build your project and errors will be gone
(probably optional)
6. Change the target and Minimum SDK in the Android Manifest

Categories

Resources