So I have just started running through the tutorial located here
Even though it starts off easily enough, with everything being described, the second chapter rushes you through action bars.
I have managed to import appCompat; which was located at C:\Users\New\Desktop\Programmin' languages\Android dev\adt-bundle-windows-x86_64-20130522\eclipse\sdk\extras\android\support\v7\appcompat - for me.
After importing appCompat I referenced it by going to properties>android and then the adding it to libraries.
What is confusing me is that the compiler allows me to write
public class DisplayMessageActivity extends ActionBarActivity {
without any errors; though I have referenced
android:support:v7:app:ActionBarActivity
so I didn't think that would give me an error.
Errors are coming from things like action_search (which I'll assume is a referenced xml) and openSearch() (a referenced class) - in my java activities
and #drawable/tab_unselected - which is located in my drawable-hdpi (under res).
I'm assuming that the person who wrote the tutorial presumed that my project would get these resources from the appCompat directory, but for some reason it isn't.
Please help, because the next chapter just goes on to describe how to develop new things - without addressing issues that could arise first.
Please see here on how to properly include the appcompat libraries in your Android project.
Related
Class referenced in the manifest, se.linerotech.myapplication.RepositoryActivity, was not found in the project or the libraries
this is my first app ever (github browser),am copying the steps from a video and when i tried to debugg my app to see if i was getting the data for user it crashed
i tried to redo the steps and go over everything i did but it didnt work
Just to be clear, you have two different errors in those screenshots.
The one in the manifest is saying it can't find the Activity class with that name, for the reason outlined in CommonsWare's answer - it's looking for se.linerotech.myapplication.RepositoryActivity, and that's not where your class is. It's in red because it's an unrecognised name/not found.
The other error is in the output window - it's saying you have an Activity class at se.linerotech.myapplication.acitvity.RepositoryActivity which hasn't been added to the manifest. This is true (you tried adding it, but didn't do it right) and every Activity needs to be included in the manifest, which is why it's complaining.
The two errors stem from the same issue, I just wanted to make it clear what each one means, since if you just looked at the error log you might think you've used the correct fully-qualified name for the class (it's right there in the output!). But it's two different sides complaining about the same thing for different reasons.
Class referenced in the manifest, se.linerotech.myapplication.RepositoryActivity, was not found in the project or the libraries
That is because you do not have a class with that fully-qualified class name.
Your class is se.linerotech.myapplication.activity.RepositoryActivity, because it resides in the se.linerotech.myapplication.activity package. Use se.linerotech.myapplication.activity.RepositoryActivity instead of .RepositoryActivity in your manifest.
I am facing a strange problem.
I have a solution that contains an Android project and a class library project.
If in that library project I execute this line:
String s = "Código inválido";
This is actually shown when watching the variable: Código inválido.
However, when I do that assignment inside the Activity code, the text is shown correctly as Código inválido.
What may be wrong with this?
The origin of the problem was when I tried to show, in the Activity layout, a text that was assigned in a class library method. After a lot of digging, I found what I expose in this question.
Just in case, I tell you that all files encodings are UTF-8, and in the project settings all encodings are also UTF-8.
This is Android Studio 4.0.1
Thanks
Jaime
We've been using the Navigation component in our project but have stumbled across an issue which seems unique to our project and the JetBrains Android plugin. I can't pinpoint the exact point it started happening but I noticed it after the release of AS 3.2.
The project builds fine however when editing a navigation XML things such as auto-complete and highlighting are broken and the Android Support Plugin throws this error:
java.lang.IllegalArgumentException: Multiple entries with same key: org.jetbrains.android.dom.navigation.NavigationSchema$TypeRef#0=org.jetbrains.android.dom.navigation.NavigationSchema$NavigatorKeyInfo#17d69e53 and org.jetbrains.android.dom.navigation.NavigationSchema$TypeRef#0=org.jetbrains.android.dom.navigation.NavigationSchema$NavigatorKeyInfo#442c4fde
at com.google.common.collect.ImmutableMap.conflictException(ImmutableMap.java:215)
at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:209)
at com.google.common.collect.RegularImmutableMap.checkNoConflictInKeyBucket(RegularImmutableMap.java:147)
at com.google.common.collect.RegularImmutableMap.fromEntryArray(RegularImmutableMap.java:110)
at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:393)
at org.jetbrains.android.dom.navigation.NavigationSchema.buildCacheKeys(NavigationSchema.java:488)
at org.jetbrains.android.dom.navigation.NavigationSchema.init(NavigationSchema.java:479)
at org.jetbrains.android.dom.navigation.NavigationSchema.createIfNecessary(NavigationSchema.java:389)
at org.jetbrains.android.dom.AttributeProcessingUtil.processNavAttributes(AttributeProcessingUtil.java:408)
at org.jetbrains.android.dom.AttributeProcessingUtil.processAttributes(AttributeProcessingUtil.java:596)
at org.jetbrains.android.dom.AndroidDomExtender.registerExtensions(AndroidDomExtender.java:57)
at org.jetbrains.android.dom.AndroidDomExtender.registerExtensions(AndroidDomExtender.java:29)
at com.intellij.util.xml.reflect.DomExtenderEP.extend(DomExtenderEP.java:83)
at com.intellij.util.xml.impl.DynamicGenericInfo.runDomExtenders(DynamicGenericInfo.java:134)
at com.intellij.util.xml.impl.DynamicGenericInfo.lambda$checkInitialized$0(DynamicGenericInfo.java:64)
at com.intellij.openapi.util.RecursionManager$2.doPreventingRecursion(RecursionManager.java:98)
at com.intellij.util.xml.impl.DynamicGenericInfo.checkInitialized(DynamicGenericInfo.java:63)
at com.intellij.util.xml.impl.DynamicGenericInfo.getAttributeChildrenDescriptions(DynamicGenericInfo.java:241)
at com.intellij.util.xml.impl.DynamicGenericInfo.processAttributeChildrenDescriptions(DynamicGenericInfo.java:254)
at com.intellij.util.xml.impl.DomSemContributor.lambda$registerSemProviders$5(DomSemContributor.java:199)
at com.intellij.semantic.SemServiceImpl$2.lambda$registerSemElementProvider$0(SemServiceImpl.java:93)
at com.intellij.semantic.SemServiceImpl.createSemElements(SemServiceImpl.java:190)
at com.intellij.semantic.SemServiceImpl.getSemElements(SemServiceImpl.java:161)
at com.intellij.semantic.SemService.getSemElement(SemService.java:37)
at com.intellij.util.xml.impl.DomManagerImpl.getDomHandler(DomManagerImpl.java:390)
at com.intellij.util.xml.impl.GenericValueReferenceProvider.getReferencesByElement(GenericValueReferenceProvider.java:47)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.getReferences(ReferenceProvidersRegistryImpl.java:135)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.mapNotEmptyReferencesFromProviders(ReferenceProvidersRegistryImpl.java:123)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistryImpl.doGetReferencesFromProviders(ReferenceProvidersRegistryImpl.java:102)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:50)
at com.intellij.psi.impl.source.resolve.reference.ReferenceProvidersRegistry.getReferencesFromProviders(ReferenceProvidersRegistry.java:44)
at com.intellij.psi.impl.source.xml.XmlAttributeValueImpl.getReferences(XmlAttributeValueImpl.java:110)
at com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor.checkReferences(XmlHighlightVisitor.java:439)
at com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor.visitXmlAttributeValue(XmlHighlightVisitor.java:406)
at com.intellij.psi.impl.source.xml.XmlAttributeValueImpl.accept(XmlAttributeValueImpl.java:61)
at com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor.visit(XmlHighlightVisitor.java:587)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.runVisitors(GeneralHighlightingPass.java:353)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$collectHighlights$5(GeneralHighlightingPass.java:286)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:313)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:316)
at com.intellij.codeInsight.daemon.impl.analysis.XmlHighlightVisitor.analyze(XmlHighlightVisitor.java:597)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:316)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.lambda$analyzeByVisitors$6(GeneralHighlightingPass.java:316)
at com.intellij.codeInsight.daemon.impl.DefaultHighlightVisitor.analyze(DefaultHighlightVisitor.java:71)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.analyzeByVisitors(GeneralHighlightingPass.java:316)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectHighlights(GeneralHighlightingPass.java:283)
at com.intellij.codeInsight.daemon.impl.GeneralHighlightingPass.collectInformationWithProgress(GeneralHighlightingPass.java:227)
at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:69)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$null$1(PassExecutorService.java:423)
at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1171)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:416)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:582)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:532)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:87)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:415)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:391)
at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:147)
at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:222)
at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:389)
at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:161)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
We're running the latest version of the navigation component (2.0.0-rc2) and and I've tried all the usual fixes (Invalidate Caches & Restart etc). I've tried using navigation in fresh projects and it seems to work without this error being thrown.
I have tried removing all nav XMLs from our project and then adding in a completely blank XML but it still throws the error. I delved into the source of the plugin and it seems this occurs when the plugin is initially processing the nav file for the design view which doesn't make sense if it's throwing it for a fresh nav file.
I'm currently at a loss as to why this may be happening and any ideas would be greatly appreciated!
The short answer:
I fixed it by moving an anonymous class which extended androidx.navigation.Navigator to a separate class and adding the annotation #Navigator.Name(String name) with a unique name.
If you are also experiencing this issue check that in your project or its dependencies if there are any classes inheriting the Navigator class which are either missing the #Navigator.Name(String name) annotation or using non-unique strings as the name parameter. fragment and activity cannot be used as they are used already within the API.
Further info:
After further delving into the Android Support plugin source code to understand what's going on I've managed to solve the issue on our project.
When initiating the IDE functionality in the Android Support Plugin it goes through your project and any dependencies looking for any class which inherits the Navigator class and gives it a tag for the purpose of managing it in the XML files and design view. This tag is based on an annotation #Navigator.Name(String name). If no annotation is present a default value is used.
These tags have to be unique as they are used as the keys for building an immutable map of tags to navigator types. In our project we had an anonymous class which was extending Navigator class and had no annotation.
There is also an anonymous class extending Navigator within the navigation component source, specifically within the NavDeepLinkBuilder class. As there is only a single default value for the tags any other class inheriting Navigator with no annotation being present in your project or its dependencies will cause this issue.
I am using Eclipse Indigo for Android development. The problem i face is that it does not allow #Override for non Activity overwritten methods. For example if i implement onErrorListner of MediaPlayer and i set attribute #Override with it then it gives the following compile time error:
The method onError(MediaPlayer, int, int) of type MyActivity must override a superclass method
And to fix this problem, i am suggested the following
Remove "#Override" annotation
Tough removing the #Override fixes the issue but why does it complain about it and also removing it may cause stopping some functionality of its parent etc??
I have downloaded many examples which use this "#Override" attribute with non-activity methods which proves that this is used and i might be missing some obvious thing. But i cannot run these examples in Eclipse Indigo without removing these "#Override" attributes from all the classes.
Why?
Any help is greatly appreciated.
Your project Java compiler level is set to 1.5 instead of 1.6. See here.
It is not good to remove that line. you need to change to JDK version in your eclipse then you will not get such errors. Follow, following steps for it,
Right Click on your Project & select Properties.
Then from the left section Select Java Compiler & select the Version of the JDK you installed. If it is already selected then de-select it & try it.
I'm making a paid/free version of my app so have a 'Library Project' that the two apps use.
I'm trying to use Android Annotations to clean up my code:
http://code.google.com/p/androidannotations/
Unfortunately when I use this in my shared library project, one of my projects gets the error in Eclipse:
The type xActivity_ is already defined xActivity_.java /ProjectName/.apt_generated/lib/activities/
Because Android Annotations automatically creates a new activity with an extra '_' in the folder .apt_generated one of the apps is allowed to create this file, but the other gets the error "already defined".
Is there a way in Eclipse to resolve this? Or is it a problem with the Android Annotations?
This seems to be an AndroidAnnotations bug, and should be reported on the dedicated bug tracker.
AndroidAnnotations wasn't designed with this use case in mind, but this is still a very valid use case. The problem seems to be that the activity is generated in the shared library project, when it should be generated in each depending project, am I right ?
(please answer in the bug tracker)
This question is quite old, but I thought that I should mention android annotations now supports being used in libaries:
https://github.com/excilys/androidannotations/wiki/Library-projects
One caveat is that due to the way android library projects generate the R class, you cannot reference resouces directly inside the annotations. Eg, you cant do this:
#EActivity(R.layout.myLayout)
public class MyActivity extends Activity {
#Click(R.id.myButton1, R.id.myButton2})
public void someButtonClicked() {
}
}
Instead you must do this:
#EActivity(resName="myLayout")
public class MyActivity extends Activity {
#Click(resName={"myButton1", "myButton2"})
public void someButtonClicked() {
}
}
I just knew AndroidAnnotations (which seems a great tool!) but I think that if you do this using different projects (sharing the same library) your problem should be solved.