I was looking for an ePub reader in android.I referred PageTurner. Got it's apk downloaded and it worked.
But when I downloaded it's source code from github
(as it's open source) and tried to Import the project, it gives the message that No Projects found to import even though it's pointing to the correct location.
I searched for similar questions on SO, but didn't got any help.
I guess I'm missing out libraries and some other stuff that will make this work. Note that bin and gen folders are missing at github link.I'm using Eclipse Indigo as IDE.
Any idea what's wrong here? Any help appreciated.
EDIT
1.) From suggestions, I created new project and imported it from existing source but it's giving errors at virtually every line of code.
Some of the errors are like :
Package x1 does not match with package x2
class RoboActivity not found
method not found
#Inject cannot be resolved to a type
2.) What exactly do I download from Maven site?
Which libraries are required from these.
Moreover, When I tried to install the plugin from instructions, I got
3.) this link is available for Maven Plugin but I can't find the plugin here :(
Your project is maven project. Download maven plugins for eclipse then import existing project as Existing Maven Projects. Dependencies of other jar will automatically resolved if your pom.xml file is correct.
Maven Eclipse Plugin
Maven 2 Eclipse Plug-in
instead of importing try
create new project using existing source
Hope this helps
Big update: I hadn't realized that the new ADT likes Maven even less than the old one.
Let me chime in here as the author of PageTurner: personally I don't use the Eclipse Maven plugin, but I simply generate an Eclipse project with mvn eclipse:eclipse.
If you have never worked with Maven, it's a command-line build tool similar to Ant (or Unix make). You can download Maven 3 here:
http://maven.apache.org/download.html
Once you have Maven installed, the steps to import PageTurner into your Eclipse environment are:
Download and unpack the sources
Run
mvn -Djavax.net.ssl.trustStore=trust.jks -Djavax.net.ssl.trustStorePassword=pageturner -DexcludeTransitive=true dependency:copy-dependencies
inside the source folder
Create a libs folder
Copy everything in target/dependency to the libs folder
In Eclipse, select "New Android Project" -> "From existing source" and point it to the folder you unpacked PageTurner in.
Essentially this completely leaves Maven out of the game, except to get the dependencies.
if bin and gen folders are missing no matter you can also create your own project and just copy the res,src and manifeast files from that source to your project. then just refresh your project then clean it an build it will work.
This is maven based android project. So you need to download all the dependencies first, then import the project.
Read this carefully.
Related
I searched extensively but cannot not find the maven repository for org.apache.cordova.
I want to edit an existing plugin (from github) in android studio.
I have tried adding the dependency by jar file. But generating the jar fails when "ant jar" with complex errors (cannot find symbols, pointing at the imports).
Thanks for help
Greetings
Felix
Try adding to you local repository.
Look ath this thread:
I am attempting to add phonegap to my local maven repository for an android application, I'm looking for help on the steps I took
I am looking a source code repository and it only contains code for an Android project i.e. src/main/java/com/.. and no project definition files such as .idea, .iml ,.ipr, .iws - These files are included in the .gitignore file.
There are no files relating to an Android Studio project at all so I cannot open in the IDE. It has been set up for Maven so I can build that way. If I want to run/debug/alter this project what do I do?
Why would somebody exclude all IDE project files?
It's easy, the repository/source code owner don't commit the project files because the source code must be independent of the IDE used by people. The projects files of Eclipse are different from one of IntelliJ.
You can clone or download the source code and even not use any IDE. Some poeple prefer working with editors like Emacs or Vi and build the project using the command line.
There are many ways to create android projects with Android Studio and Eclipse being the main two.
If the author had to maintain project files it would add considerably to the work required as IDEs etc get updates at different rates.
This way the code is "portable" between IDEs and the author can focus on just supporting his work rather than all of the combinations of IDE/Operating Systems.
My Solution
I am posting solution here as I cannot yet answer my own question.
So, I the solution was in the Maven definition. My codebase was an SDK consisting of numerous libraries and sample apps. Each component had a POM.xml and was all contained using a Parent POM.
All I did was import the Parent POM into Android Studio. Once triggered Android Studio would create its own project files using the POM definitions for each component. All the modules were available in one instance and it built and ran instantly. It was truly beautiful :)
Steps: Import Project -> Select directory containing POM.xml -> "Import project from external model" -> Maven -> Next -> continue to create project.
I know that there are a few questions here on SO that are quite similar to mine but still none of the answers there could really help me.
The scenario is this: I am using Eclipse + ADT to develop an Android app. I recently moved to Maven for dependency and build management, to make it easier to include Spring for Android, Google Play Services, etc. At the moment building with Maven (from the command line) works but running the app with Eclipse does not work anymore.
When I:
add a new dependency to pom.xml
do mvn eclipse:eclipse to make the new dependency available in Eclipse (that's the correct to do it, right?)
I get this error: "/foo/gen already exists but is not a source folder. Convert to a source folder or rename it."
I tried several ways of making this error go away, but I all I get is other errors:
When I:
go to Properties > Java Build Path (Source tab) > Add Folder... > check gen > OK > OK
this error is replaced by "The type BuildConfig is already defined".
So I:
go to Properties > Java Build Path (Source tab) > select Foo/target/generated-sources/r > Remove
Ok, no errors now, but when I try to run the app on my device, I get:
"Caused by: java.lang.ClassNotFoundException: Didn't find class "com.bar.foo.MainActivity_" on path: /data/app/com.bar.foo-1.apk
Checking in bin/classes however, I find that MainActivity_.class is indeed generated - but somehow it is not included in the apk, I guess?
Note that the I can also see the classes from my source code, so the following, for example, works:
BrowseNodesActivity_.intent(this).start();
When I check Properties > Java Build Path (Order and Export tab) I see that the folder /.apt_generated is at the very bottom of the list. Is that a problem?
By the way, the error is exactly the same if I remove all the target folders generated by Maven from the build path so that the build path (Source tab) shows only src, gen and .apt_generated
Is there a way to get this approach - using Maven for dependency and build management but not using any Maven plugins in Eclipse - to work?
Anyway, I also tried the following approach as was suggested here:
https://code.google.com/p/maven-android-plugin/issues/detail?id=30
I installed Eclipse Maven support by:
installing m2e from http://download.eclipse.org/technology/m2e/releases
installing the Eclipse Marketplace
trying to follow this how-to from m2e-android (SO won't let me post another link)
I go to Eclipse Marketplace
type "android m2e"
find something called "Android Configurator for M2E" (is this same as the "Android Connector"?) and install it
right click the project > Configure > Convert to Maven project
Then I get an error in my pom.xml - "Plugin execution not covered by life cycle ... com.jayway.maven.plugins.android.generation2"
So, all in all, using the Eclipse plugins for Maven didn't work either...
Is there ANY way to get all of the components in my setup to work together somehow: Eclipse, ADT, Maven, AndroidAnnotations (and optionally m2e and m2e-android)?
You have to install the m2e, m2e-apt and m2e-android plugins for Eclipse. If you have Plugin execution not covered by life cycle errors, just apply the Quick fix for it. This error is shown because m2e-android cannot use AAR libraries, yet. Enable m2e-apt to configure JDT to use the AndroidAnnotations processor, you can read it here. If its done, right click on the project -> Maven -> Update Project. At this point your app should compile, but the generated classes may not included in the APK. To resolve that, modify your .classpath. The correct classpath is here in the workin_cp.xml file.
I'm trying to implement maven into an existing android project.
I've done so through the context menu > Configure > Convert to Maven project. And everything seems okay, no warnings or errors.
But when I try to run the app (just like before) I get:
12-31 10:16:57.423: E/AndroidRuntime(14242): java.lang.RuntimeException:
Unable to instantiate activity ComponentInfo{xxx/xxx.MainActivity}:
java.lang.ClassNotFoundException: xxx.MainActivity
I've followd all the instructions on implementing m2e and everything looks like it should work.If I don't convert the project to a maven project, the app runs fine.
Any suggestions where I'm failing?
This is what my pom.xml looks like: http://pastebin.com/ByXA0BP4
This took me ages to resolve and it was the OP's answer which guided me.
After enabling Maven for the project, you need to disable "Allow output folders for source folders"
Steps:
Project Properties -> Java Build Path -> Source Tab -> Untick "Allow output folders for source folders" -> Click OK
I also noticed that I got the following message in the console, which led me down a rabbit warren of false leads:
trouble writing output: already prepared
I figured it out myself.
After converting the project to a maven project, right click on the 'src' folder and chose Build path > Use as Source Folder
Now the project runs fine
ClassNotFoundException is simple, the respective jar is not there in class path.I checked your pom.xml, but i was unable to relate any dependency that could have xxx.MainActivity.
So just ensure that respective jar is there as dependency artifact that contains MainActivity. If it still would not work, try copy pasting the jar manually into deployment\lib folder and it should work. Another option could be to debug your current CLASSPATH location and see if your jars are there or not.
Also by default Maven probably would not update dependencies. You have to right click->Maven-> Update Project to download any newly added dependencies in your pom.xml. There might be an error downloading dependency for that you have you to find the right repository or download the jar locally and install it as local artifact.
Thanks
You may check if the virtual or real device where you are testing the app is actually compatible with the target Api of the project. Change it to the proper one and check again.
I'm a little newbie on Android programming and the Eclipse IDE.
And I'm having some difficulties to import this lib/project (how do I call it?) into my currently project.
The link to the GitHub repo:
https://github.com/timroes/EnhancedListView/wiki
There the author wrote a "How to include", but I tried the last one (by my one), since I use Eclipse.
"How to include
You need to include the library into your project, by one of the
following ways:
Include it from Maven Central (recommended)
Just enter the following line to your build.gradle file in the dependencies section:
compile 'de.timroes.android:EnhancedListView:X.Z.Y#aar'
Where X.Y.Z is a valid release. You can find all releases on the release page or directly in Maven Central.
If you use Maven to build, just use the above coordinates in your pom.xml.
Download the aar file from the release page and reference it in the dependencies section of your build.gradle:
compile files('libs/EnhancedListView-X.Y.Z.aar')
If you are using Eclipse or Ant, you are on your own. You most likely want to download the sources and import them in your build system."
I tried to include it to the build path, but didn't work. Nothing found on internet. Do I have to include something besides adding project into build path? Do I import it like a lib or project?
Do any of the others options to include would work for me? How do I do it?
Thank you very much!
There is no one click method for Eclipse users. You have to copy the EnhancedListView.java into one of your src packages, the content of the resource directories into your project's resource directories and the annotations.jar from the libs directory to your libs directory.