how to disable missing '#override' annotation check in Android Studio - android

I want change codes, in run time Compile classes. but I can't change codes of this classes.
I search and realized that i have the option to deactivate.
This option's path in eclipse is : windows - preferences - java - compiler - errors/warning .
but I can't find this path and option in last version on Android Studio (1.2.1.1).
please show me this option (missing '#override' annotation), in last version of Android Studio.

it is in Settings -> Editor -> Inspections. By default it should be disabled

Related

"Code Cleanup..." feature of Android Studio v2.2.2

In Android Studio v2.2.2, Code Cleanup feature available under Analyze option.
Analyze >> Code Cleanup
What this option exactly do with code ?
Please explain in details.
When you clean up your code using 'Android Studio', It start inspecting code defined rules.
For list of defined rules check, File -> Settings -> Editor -> Inspection.
(For Mac, Android Studio -> Preferences -> Editor -> Inspection)
Here you can find all rules like,
non-used variables,
non-used import,
Abstaraction issues,
Code style issues,
Java Beans issues etc.
After inspection of code, Android Studio will remove such code from your files that is not necessary. It is called cleaning up code.
There are many plugins available for it. As Android Studio support by default, You can format and clean your code using this feature.

Cannot find annotation method 'anyOf()' in type 'RequiresPermission':

I am trying to port an Android app in Android Studio to Visual Studio 2015 / Xamarin. I try to run the project and I get:
Android application is debugging.
The application could not be started. Ensure that the application has been installed to the target device and has a launchable activity (MainLauncher = true).
Additionally, check Build->Configuration Manager to ensure this project is set to Deploy for this configuration.
I added [Activity(MainLauncher = true)] to the main class and checked Build->Configuration which appears to be correct, but these have no effect.
I get this warning:
Cannot find annotation method 'anyOf()' in type 'RequiresPermission':
class file for android.support.annotation.RequiresPermission not found
MyApplication.Native.Droid C:\Users\allelopath\AppData\Local\Xamarin\GooglePlayServices.Maps\8.4.0\embedded\classes.jar(com/google/android/gms/maps/GoogleMap.class)
I also get this warning:
Warning
Found conflicts between different versions of the same dependent assembly.
In Visual Studio, double-click this warning (or select it and press Enter) to fix the conflicts;
otherwise, add the following binding redirects to the "runtime" node in the application configuration file:
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly><assemblyIdentity name="System.Net.Http" culture="neutral" publicKeyToken="b03f5f7f11d50a3a" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /></dependentAssembly></assemblyBinding>
Acquaint.Native.Droid
I double click as it suggests and it asks:
Do you want to fix these conflicts by adding binding redirrect records in the application configuration file?
I click Yes. This ultimately has no effect, after rebuilding and trying to run, the warning reappears.
I unstalled the app on the device, which had been there from running it on Android Studio, but this had no effect either.
What can you suggest?
For the first problem I would right click on your solution, go to Configuration Properties and ensure that all of the correct projects are being built and that your android project's Deploy box is checked. This is just a bad Xamarin tendency.
I have the second warning myself and it is simply because the Android Support Library requires you to compile against sdk version 23. The Google maps package must use these new annotations. I haven't encountered any problems because of this error, with a minSdkVersion of 15, so I just live with it.
I also have the same dependent assembly warning and what I think is happening is I have one project which is using a newer reference to .net primitives than whatever .net http is using. Just a guess but I am also not worried about making this happy.

Manifest gives error once Remove BlackBerry Nature From Project

I added BlackBerry Nature to Android Project and remove the BlackBerry Nature From Project. After that Android project Manifest shows error and not build the project. I did not do any changes on Manifest and just show error mark.
I closed the eclipse,clean and build the project but still same
How to solve this ?
Did you miss
<?xml version="1.0" encoding="utf-8"?>
at the beginning of your AndroidManifest.xml ?
After several hours I found a solution actually I don't know what happen but it worked.I change the java compiler version to 1.5 and build the project, again I changed the compiler to 1.6 and build the project Then and only it fixed. ;)
You may need to prevent Blackberry plug-in from involving in making procedure.
Here are the steps:
open menu "Windows" -> "Preferences" -> "BlackBerry" -> "BlackBerry Plug-in for Android Development Tools"
under the title of "Verifier options" , un-check "Enable APK verifier ( checks ....) "
confirm the change by clicking on "Apply" button or "OK" button.
open menu "Windows" -> "Preferences" -> "BlackBerry"
under the title of "BlackBerry Reference" , check "Clean distribution folder("dist") when BlackBerry nature is removed"
it would be better to delete the BlackBerry Targets.

How to solve this : 'Running android lint' issue

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/

How do I force eclipse to update the apk on my hardware device with each build?

If I change some code, save, and Run, it runs the last version of the program, not what I just saved. The only way I can make it update is if I Clean the project, Build the project, and then Run the project. Is there some way to avoid this tedium?
I spent some time create two dummy projects (one Android and one Java) and have a play with it, and finally come up with a workaround which is not used very often but able to solve your requirements.
First, I will explain your question a bit more (based on my understanding and what I have tried) so that other people can have a more clear understand about what is happened here.
According to the conversation in comments:
could you tell me what you have in following setting: project->properties->Builder ? – Sudar Nimalan
#SudarNimalan: I am not sure this is what you are asking, but: there's text that says "Configure the builders for this project", and under it is a single option, "Java builder", which is selected (checked). – shino
for android project, there should be, "Android Resource Manager", "Android Pre Compiler", "Java Builder", "Android Package Builder" in this order, chould you add those and try? – Sudar Nimalan
#SudarNimalan: I owe you an apology; I do have those four components. My "project" is split into 4 projects - "core", "core-android", "core-desktop", and "core-html". It's a little weird because I set it up with the libGDX project setup UI, and I was looking at the 'core' project when I answered your question. My 'core-android' project has all four (in that order), and it is the one that has the problem in my question. – shino
Scenario:
You have 4 project:
core: a regular java project (common pure java code here)
core-android: an Android application project.
core-desktop: not related to question so ignored.
core-html: not related to question so ignored.
The core-android project has dependency on core project, by adding core to core-android's build path (Properties -> Java Build Path -> Projects -> Add ...) and export list (Properties -> Java Build Path -> Order and Export).
Problem (Not Really):
Change some code in core and save it, run core-android, eclipse install last compiled apk, not the new one with change.
Reason:
The is the expected behavior, the way you used to reference core project in core-android only create a weak link (or something sort of) between core and core-android, the core-andorid's auto-build script doesn't aware any changes made in core. You have to clean the project (only need clean core-android project) so that Eclipse can delete the existing apk (under bin directory) and re-generate the apk (with the latest code changes from core).
See Xav's comments below, Android SDK tools should aware changes from plain Java project under project build path, and it does not behaviour this feature normally at the moment.
Note that if core is an Android Library project, then there is no problem and your core-android project will aware any changes in core project (java code, android resource and etc), if core is only used in core-android, this could also be a workaround: turn Java project core into Android library project.
Workaround (Eclipse Link Source):
There is another way (not commonly used) for adding soft link between projects:
First, you need remove core project from core-android's build path, this will also remove it from Export and Order list.
Right click core-android, choose Build Path -> Link Source ... Add ../core/src as Linked Folder Location and src-lib1 as Folder Name,see screen screen in the end.
This create a symbolic link src-lib1 under core-android in Package Explorer windows point to core's src foder, in the file system, you still have two separate project folder. Now if you change some code in core and run core-android, Eclipse will build and install latest apk. No need to clean core-android project.
Link Source Window:
Final look in Package Explorer:
You should always consider the normal approach as first option, after all, manual clean project is not a big deal compare to the unusual approach I described above.
Please follow this steps..
1. Project--> Build Automatically been checked??
2. Please following setting: project->properties->Builder like that?
Check below image.
And Also Check Below Settings.
Also Check Below Image
IF problem continues then please Update your ADT & SDK.
Hope it works for you .
Navigate to Windows->Preferences->Android->Build. Make sure that the checkbox "Skip packaging and dexing..." is NOT checked.
The Problem is the In your Eclipse, go to Project Properties - Builder, There is one CheckBox with AndroidPackageBuilder that is required to be Checked True. Now everytime you will do any changes in you project that will be reflected in your build and the Compiler will never say that
"Application Already Deployed, No need to Reinstall"
This will work evenif you dont have selected Build Automatically, Because everytime you run by clicking Run icon or Ctrl+F11 that will first Build the Project and Then Run it. So The requirement is just to Enable the Android Package Builder
You won't believe how easy and silly is the solution
On Eclipse,
go to Window-Prefences->run/debug ->launching
And then, on Save required dirty editors before launching :
choose the Prompt option,
Apply and OK

Categories

Resources