Package Name change results in permanent permissions problem - java

I mistyped the package name when I created my android project, and it took me a while to notice. I used Eclipse's Rename function on the package to change it, and sort out all the references. I've updated the Manifest, and manually checked every file for any references to the old package name. However when I launch the app (it's a live wallpaper) and click settings, I get an IllegalStateException, exactly as if the permissions were not set up correctly (which they are). I've manually uninstalled the app and restarted eclipse. Is there any way out of this?
Update:
This is an android problem, not an eclipse problem. I created a new project in eclipse, and copied everything over, and when I ran it I got the same error.
Further update:
I've managed to get it working, I had to set the Activity to export in the manifest.

You can try to Clean the project like this:
(In the menu) Go to Project -> Clean -> and try to clean your current project.
I had a similiar issue before and this solved it.

Related

Eclipse compile project, but actually not

I reinstall OS, pack my workspace on flash drive, with hopping, of just needing to copy/paste projects in workspace of ECLIPSE (luna) exactly i used on prior installation.
I included it all, no where RED. All seem ok, but.
I tried to change some behaivor on my program, and eclipse compile program regular, but on phone is the same program i stoped working on, prior reinstallation.
( *also tried to delete app, and install again )
Next what i done, to make me 100% sure that is eclipse issue, i add some obiviously exception, like not setting setContentView, and so on...
But it compile, and give me correct .apk.
What i tried:
Tried to change workspace, and copy/paste just src, res, and manifest file.
Also checked manifest file in bin, and it's exactly same as in root folder for project.
What to do? Is this some zombie
EDIT : Windows 8.1
I think copy/paste does not work. You need to import your projects into eclipse. Yu can do that by going to File>Import>Existing projects into workspace> and browse to your flash drive
so, this happend
In transaction, somehow eclipse made new package
main_activities
And i was to fast to take look at that. My main activities what try to edit was in package with name
activities
I dont know why eclipse did that...
I accidently take look at manifest file and found this issue...

crashlytics can't run/reference/import

I have been trying to install crashlytics for the passed 6 hours with no succes.
The first time it started downloading some libraries but something went wrong and I had to delete them all again. I'm talking about the ones that it places in the lib folder it creates (not sure of the exact name of that folder).
After that it simply refuses to redownload them and just sits there on the "build and launch the app" window so it can "verify" its configuration.
So here's the issue, because it doesn't download the stupid libraries i can't import them in any of my classes or use them.
Fabric.with(this, new Crashlytics());
gives errors ofcourse because it can't resolve "Fabric" or "Crashlytics". Why the people at crashlytics don't give you the simple option to download the jar file(s) yourself is beyond me...
In any case, here's what I've tried:
uninstalling the eclipse plugin
searching for EVERY reference to fabric and crashlytics and deleting them if relevant
deleting all contents and whatnot
deleting eclipse's artifacts.xml file
Since it's a git project I even deleted all the project files, created a new git folder and pulled them again there.
manually attempt to put some of the jars from the plugin folder in my libs folder and adding them to my build path
but nothing works... help?
Follow the steps to integrate Crashlytics to application.
If it is first time then fabric will support you in doing the setup.
https://fabric.io/onboard given option to select SDK.
Select SDK and started integrating.
Successfully able to add plugin.
After SDK restarts, clicked on the Fabric toolbar button to start using Fabric!
Logged in -> Selected project -> selected kit to install.
Follow all the steps initiated by tools.
change of android-manifest file.
add code in the java class.
add shown code to kits.properties (Eg: com.crashlytics.sdk.android:crashlytics:2.2.2)
Final step will show you the done. (If you haven't done the three steps properly in step 6 then you can't be proceed further).

Android on Intellij showing error: is not an activity

I have just imported my android project into intellij from eclipse. I am new to intellij.
I have gotten everything working and set up the run configuration for Android. When I run it, it gives me the edit configuration screen.
When I say launch the default activity, it tells me that it can't find the default activity, which is odd. When I code the activity to launch straight away, it tells me that that's not an activity subclass or alias. I double-checked and the class is certainly an activity.
When I ignore it and run anyway, it blows up as soon as it hits the phone.
Can you help me understand/fix these errors, please?
In the Intellij project structure dialog, select the module that your Activity is residing in.
Then under the sources tab, add the root folder of your sources as sources for this module by clicking the 'Mark as Sources' link or button. The sources root folder should be mark blue.
The module can now find your sources and launch the activity.
My solution was to delete and recreate the run configuration.
In my case, none of these solutions worked. Then I started digging.
As I remember, my java files had to be placed in src/main/java/com.something.blabla. Then I realized that the directory has changed to src/main/java/com/something/blabla.
So I created a new com.something.blabla folder under ../java/ and moved my java files to that folder. I removed the com folder, and it worked perfectly.

R.java is missing on a clean Android Project

I'm creating a clean project on ADT and I noticed that the gen folder is empty (with no R.java in it), not letting me run the project. I'm running ADT with all stuff up-to-date (as you can see here)
I already cleaned and built it in every possible way. I also tried to reimport the project, and nothing. There are no errors in the XML files.
I searched for a solution and I found a lot of people with the same problem, and in most cases the solution was to update the SDK tools, but it didn't work for me.
Is there a reason for this?
at the top of screen, click build -> rebuild project
Give it a few seconds. it worked for me, i hope it save you aswell
im using Android Studio(beta) 0.8.9
My R disappeared after i fiddled with sound files in my res/raw directory(converted them to different formats, figuring out how SoundPool class works...and suddenly there is red "R"'s everywhere!
Try right clicking on the project, then going to Android Tools > Fix Project Properties.
If that doesn't work, then try cleaning it before and possibly after that.
If R.java disappears, you usually have to recreate the project from scratch again.
There are many reasons for R.java missing issue, i use to face this issue frequently, some of my thoughts to debug this issue.
Try creating another test project using File->New->Project->Android->Android Application Project. After creating the project run the project in emulator. If every thing works then your setup is perfect.
Check your imports section of your java files, some times default R.java gets included which is from android package. In this case Remove that import and add correct import statement.
Check your "res" folder all the xml's should be well formed and valid.
Hope these debugging steps may help to find the root cause.
try deleting the r.java file in gen folder. when you run again after cleaning and building the project. It should recreate those files and it should work after that. Try that.
Other wise you might have to reinstall Eclipse as you have tried in so many different projects
Something I just noticed was that after I removed the auto-generated code for the menus (which I wasn't using) it started causing errors. Eventually when I cleaned with the menu xml's still in the file structure, my R file disappeared. I removed all entries in the menu folder and then cleaned again. This worked for my specific instance. Hope this helps others as well.

android-support-v4.jar isn't importing correctly in Eclipse

I'm trying to get an app to compile that uses the android-support-v4.jar and the Fragmentation classes it contains, but I keep getting messages whenever I try to compile that there are errors in the code. All of the errors have to do with different Fragmentation classes that are in the .JAR. I have tried ctrl-clicking the project folder and then selecting Android Tools -> Add Compatibility Library and I keep getting this error:
[2011-12-20 11:55:31 - Android Compatibility JAR not found:]
/Applications/eclipse/Eclipse.app/Contents/MacOS/v4/android-support-v4.jar
Why would it be looking for the .JAR in Eclipse's Package Contents? I've gone into the project properties and went to the Java Build Path, and imported the .JAR from the MainActivity/libs folder, that didn't work, and then I tried to import it from my SDK directory, and that didn't work. I've fixed the project properties and cleaned and built it countless times, I've restarted Eclipse, my computer, re-downloaded and installed Eclipse, the Android SDK's and ADT and still nothing. I am completely stumped.
Edit
I've gone through the build path and imported the .JAR from both the MainActivity/libs and my SDK directory. For the hell of it I added the .JAR in the directory that keeps appearing in the errors and that hasn't worked. What's making Eclipse look for it in it's Application Package Contents?
Update
So after tinkering the project contents aren't showing any errors but the MainActivity folder still says that there is one and I still can't compile.
Like nyah:
Revision
So I think the question may be "Why is Eclipse looking for the .JAR in the Eclipse Application's package contents instead of the libs directory of the project or the Android SDK directory that I used to import it as an external .JAR?"
Update #2
I am only getting one error now after tinkering, it's on this method:
#Override
public MenuItem setOnActionExpandListener(OnActionExpandListener onActionExpandListener) {
// Noop
return this;
}
The Quick Fix says that I should delete the #Override annotation but that method must override a super class method.
These are the errors that it shows:
Multiple markers at this line
- The method setOnActionExpandListener(MenuItem.OnActionExpandListener) of type SimpleMenuItem must override a superclass method
- implements android.view.MenuItem.setOnActionExpandListener
Looks like it is looking for jar here :/Applications/eclipse/Eclipse.app/Contents/MacOS/v4/android-support-v4.jar
android-support-v4.jar is found in <sdk>/extras/android/compatibility/v4
Please make sure you add this as an external jar in the java build path
I could solve this problem by
1- delete "android-support-v4.jar" from lib
2- right click on the name of the project choose "Android Tools" and "Add Support Library"
If this is still not solved:
Like already said, in Eclipse go to your Project Properties > Java Build Path > Libs > Add External and get the one from the adk directory.
Also set up Java 1.6 as your default compile version if you already haven't. This should solve the Override Errors you described.
It turns out that my Debug Certificate had expired so I just needed to delete ~/.android/debug.keystore and restart Eclipse and everything worked.
I realize that this question has been answered, but this is a known issue that is supposed to be fixed in the ADT-17 plugin release according to comment 9 here: http://code.google.com/p/android/issues/detail?id=21488
In addition, people who have this problem can copy the compatibility JAR to the location it says it can't find it. Clearly it's looking in the wrong place (since it's checking the Eclipse directory rather than the android-sdk directory), so the simple fix, for now, is simply to put the package where it wants to find it, even though it doesn't belong.
For me it was as simple as copying the v4 directory within C:/android-sdk/extras/android/support/ into the C:/eclipse/ directory.
I had the same problem running in Ubuntu. Go to Tools->Options.
Check Force https://... to http://
Open Android SDK Manager. Check Extras->Android Support Library.
Something similar happened to me. At the top of MainActivity.java I had the next imports giving errors:
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
In each of the lines on the left they had the light bulb making some suggestions. If you click on it, one of the options will be "Fix project setup". You then will be able to choose between several options for fixing the imports, you should choose the one that specifies the android-support-v4.jar.
Right click on ur project --> select android tools --> select add support library and simply installed the supporting libraries.
Do you try not to do Android Tools -> Add Compatibility Library, and only add the jar in java build path library?.
I use this jar library of this way and it works without any problem.
I had the same problem.
Under the project properties:Java Build Path:Order and Export tab, the box next to android-support-v4.jar wasn't checked. I checked the box, and the error went away.
Another caveat was running Android SDK Manager in Windows 7 without administrator privileges. It would try to install support package, but would always fail, and the actual package never got downloaded to
C:\Program Files (x86)\Android\android-sdk\extras\android\support\v4\android-support-v4.jar
Solution: Make sure that you enter the same API for "Target SDK" and "Compile with" during Android project creation (or in the Manifest file once created).

Categories