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.
Related
Yesterday I downloaded JDK and Netbeans as my IDE. When I attempt to create my first ever Java project, I get
"no main class found"
as shown by the screenshot below
What do I do for the correct setup please?
I have since clicked on Properties>Run
and still have the same problem.
The syntax errors are shown in the screenshots below.
Would it have anything to do with my setup of src folder?
Right click on your Project in the project explorer
Click on properties
Click on Run
Make sure your Main Class is the one you want to be the entry point.
Click OK.
Run Project
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).
I'm using Eclipse Luna for creating RCP Application. I set product configuration file for plug-in project. When I run application by click Launch button (Launch an Eclipse application) from Overview page, (1) it keep show old code, not changed one.
So, I exported my application. The first time works find and then second time this one also doesn't show changed codes. I have to remove folder every time for checking updated codes.
Please, someone help me to figure out these issues. It's really bugging me.
Keep showing old code from Launch an Eclipse application & Eclipse Product export wizard
Launch and exported file show different layout
From Launch
From exported file.
I found to run with updated source after exported files. Do uncheck "Generate p2 repository" & "Allow for binary cycles in target platform" when opened Export dialog. After unchecked it them I could get updated files. It looks it happened for application version managing (P2 Folder).
When I'm debugging my code in Eclipse, I get annoyed when I open up the editor to find out I cant edit it because I'm actually viewing the source of the .class file. How do I get Eclipse to open up the .java file instead of the .class file when in debug mode?
EDIT: When I hit a breakpoint in my code, it brings me to MyFile.class, instead of MyFile.java, so I can see my code but not edit it.
EDIT: I'm guessing it has somethign to do with Android and ADT R18
After I finally found some time and good reason to look into this issue a bit deeper I'll elaborate a bit on Thornbjorn's answer.
As of lately, Google changed the way your Android projects package your external Android libraries. In ADT R17 (I think) it started packaging the external projects source into .jar files and including them directly into your project in the Android Dependencies or /libs folder.
Now, when the debugger hits a breakpoint, it brings up your source code in the .jar, essentially telling you to edit a .class file. The problem is that this file is read-only and so you have to go find your .java source manually. (Pain)
The fix is to right click the Project name in the debug view, and select "Edit Source Lookup..." from the menu. From there, remove the Default lookup path. After that, manually add the associated projects (not jars) that your project references. This is done by clicking Add, selecting Java Project, then checking the appropriate projects.
OK, so I hate to be "that guy", given the number of people for whom this worked, but this didn't work at all for me. I mean that the "Edit Source Lookup..." menu item was not in the context menu. I did not miss the instruction to do this in the Debug Perspective (presumably in the Project Explorer in the Debug Perspective). I tried it while the app was running and while the app was suspended. I tried checking the menu for the application's project (presumably what the instructions refer to) and for the library's project. No dice. This is with the latest Eclipse build.
However, I was able to resolve the issue:
Set a breakpoint in either your application or the library you are trying to link source for. You can actually put this anywhere as long as the library you are trying to link source for has a function that will appear on the call stack when the breakpoint is hit.
Start debugging your application.
Navigate your app to hit the breakpoint.
Make sure you are in the Debug perspective.
In the Debug tab (where the call-stack appears), find any function from your library.
Right-click that function. The "Edit Source Lookup..." menu option should be there (close to the bottom).
From here, the instructions are the same as Styler's. Click "Add", select "Java Project" and add your project (or multiple projects).
Before you exit the "Edit Source Lookup..." window, if you are like me, you will see that Eclipse has chosen to add a bunch of stuff to the list that you didn't choose. Some of that stuff (probably under expandable items with names like "Android Private Libraries" may be the jars for the libraries you just added source for. Remove those jars from the list.
Profit!
Open main project properties -> Java Build Path -> Projects tab and add there projects the main project depend on.
Switch to Order and Export tab and uncheck Android Dependencies
Enjoy
For some reason Eclipse does not believe that the class file comes from your Java file. This is frequently a malconfigured buildpath, or a jar-file used instead of the project generating the jar file.
Look in the project manager panel (<->button) to see where Eclipse finds the class file and then figure out why it uses that location instead of your project with the source file.
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.