Android Error While Making an Activity - android

I recently Installed Android Studio 2.1 and started programming. When I tried to create an activity it showed me an error. So guys Help Me to resolve this error and thanks in advance ;)

Try setting the package name to "com.example.hina_pc.task1"
As far as I have seen, the correct package name is supplied by default when adding a new activity to a project, so this shouldn't be something that just happens without you changing anything. Essentially, you just want to make sure that the package name of the activity you are adding to the project is the same as the package name of the project.

Related

Starting New Project in Android Studio

I'm new to android studio. I've imported source codes of some apps to android studio to learn. and then I started to practice by creating a new project. when new project created It doesn't show the default main activity and xml instead It showed many existing activities and xml of the existing project. I've tried to create new project a few times but it's still the same. thought that I might make some mistakes somewhere. I don't know. Please kindly help. thank beforehand !
To create a simple app on Android Studio what you have to do is to choose the Empty Activity.
Then you add the name to your app, choose the location, choose the language to program (Java/Kotlin), the minimum SDK (use the recommended one to start) and hit Finish. It should create one simple activity with one layout which shows a TextView with Hello World! as a text.
Could you provide some screenshots? It would make it easier to help you :)
For the moment, I would suggest that you make sure that you're selecting "blank activity" when you create it. Also check that you've stored your downloaded source code properly.
Android Studio remembers last opened project. The next time you start Android Studio, it will open last opened project.
You can choose menu File -> Close Project. Then it goes back to open/new screen which allows you to create your own project.
ah it was a silly mistake guys. I confused to click on basic activity instead of empty activity. thank you guys so much !

Android package-name issue

I am new to android and learning with a project, I have a doubt and if someone could help me it would be really helpful.
when I change the package name the app works but it doesn't allow me to goto next activity.
below is the logcat details, no error just showing this.
I have changed the package name from "com.ringdroid" to "com.ringxskah".
Even after that no solution.

Resource error in Android Studio

At the beginning of a new project organization, everything is going well. But after writing a bit of code, I encounter a Resource error. Please look at the picture, the red R.
Try to restart Android Studio. If that doesnt work import "package.name.R" and if that doesnt work change "AppCompatActivity" to "Activity"

Android Studio "Cannot resolve symbol XXX" on basic Android tutorial

I'm doing the entry level tutorial on the official Android docs. I'm currently at this step where I'm creating the second activity:
http://developer.android.com/training/basics/firstapp/starting-activity.html
The problem I'm seeing is in creating the new activity when I have to give it a hierarchical parent in the New Activities popup. I enter the name of the parent (com.juannerito.montaigne.MainActivity) but the popup doesn't recognize it and wont't let me create the new actvity.
Added to that I'm seeing a lot of "cannot resolve symbol" errors in the MainActivity class file. I'm not sure that these errors are having any material difference on the build (though I can't be really sure, as I'm a total noob), but i feel like I have to resolve these issues first before i can fix the real issue I'm having.
I'm using Android Studio 0.26 on MacOS X 10.8.4.
any help gratefully appreciated!
I just did an update to 0.26 and had the same problem. CLosing the project, and restarting Android studio and then opening the project seems to have cleared whatever it was that was causing this.
so, it turns out that Studio is (understandibly) buggy, and that these errors are false negatives...
I can also add the hierarchical parent by hand in the code so the question about the popup is moot too :/

R.java's values not recognized

I downloaded a an android project folder from a friend (the app works). In eclipse, I created a new Android project from existing code. However, there are errors at the lines calling the layouts/ids from R.java. Example: R.layout.my_layout
I tried cleaning the project, and deleting the project and creating it again. The code should be working. I checked R.java to make the sure the name matches. Note that I am an advanced-beginner at Android, so I know the basics. Please help, thanks.
if you downloaded the project from a friend, you shouldn't be creating a completely new project, but choose "new project from existing source".
try looking in the project properties under Android, many times, the import screws up the properties and moves the target SDK to the lowest possible and you'll need to change that"
it sounds stupid- but try clearing you project, make a simple change in code, save and rebuild.
i hope that'll fix your problem,
another thing- make sure u didnt imported any android.R.### class - if u did erase those lines.
Wops.
What errors are you getting in console from eclipse? Error messages are usually need to help. My only suggestion without seeing the build errors is to check your import statements. Sometimes eclipse inserts bogus import to the R classes.

Categories

Resources