Skip to content
This repository has been archived by the owner on Apr 11, 2023. It is now read-only.

Proper documentation + Wiki #5

Closed
mradzinski opened this issue Sep 15, 2014 · 15 comments
Closed

Proper documentation + Wiki #5

mradzinski opened this issue Sep 15, 2014 · 15 comments

Comments

@mradzinski
Copy link

After going through the demo and unit test projects it took me almost 3 hours to realize how to make this to work. The current documentation only talks about annotating classes and misses consumption and generation of JSON. Proper documentation + Wiki is a must.

@jacobtabak
Copy link

Seconded,

red text

Is this normal? I realize the annotation processor is looking for that __JsonHelper suffix, but the fact that it shows up as a compiler error in the IDE is very confusing.

@ttung
Copy link
Contributor

ttung commented Sep 15, 2014

The .java files are generated by running the compiler. Once that's happened once, the errors should go away.

@jacobtabak
Copy link

It's very strange... I've used a lot of annotation processing tools with generated classes and normally the errors do go away once the build succeeds. But in this case, I am able to run / debug and the symbols are never resolved. If I change the __JsonHelper to something else, then the build fails.

@ttung
Copy link
Contributor

ttung commented Sep 16, 2014

@jacobtabak I changed where the generated sources are placed in 0a822b3. you may need to reload the project, but I can now see the generated sources in android studio.

apologies; we don't use android studio/gradle internally, so there is a bit of a learning curve in getting things to play nicely with these tools. :)

@jacobtabak
Copy link

Much better now, I can step through and see the generated code now.

@ttung
Copy link
Contributor

ttung commented Sep 17, 2014

I updated the README with:

  1. Information about how to include the library using Maven.
  2. An example of how to invoke the generated code.

There is also an entirely standalone sample project in https://github.com/Instagram/ig-json-parser/tree/master/maven-example

@ignaciod
Copy link

Sorry for my ignorance, but i don't use maven very often, so i'm unable to import any of the projects in this repository into eclipse. I've m2e plugin and can't get the project imported. What should i do? I'm very fond on using this Json parser library.

@iNoles
Copy link

iNoles commented Sep 18, 2014

When I look at build.gradle, It is not setup to be android library at all. It expects you to build it for getting jar files.

@TommyVisic
Copy link

@iNoles I was able to get it running by looking at the maven-example module that ttung mentioned above. As of right now, it looks like the JSON models need to be in their own module. That module's build.gradle file needs to look like the one in the readme. Your Android module then needs to declare it as a dependency (e.g. compile project(":app:igmodel") in its own build.gradle). It looks like the reason for this is the code generation is being kicked off with a method from the Java plugin, and this plugin isn't compatible with the Android plugin. I might be making that up though.

Also it looks like Android Studio needs to be building with at least Java 1.7 and not Java 1.6.

@ttung
Copy link
Contributor

ttung commented Sep 18, 2014

@ignaciod I recommend you just download the jars from https://oss.sonatype.org/content/repositories/releases/com/instagram/ig-json-parser-processor/0.0.3/ig-json-parser-processor-0.0.3.jar. You will have to enable the annotation processor for your project in Eclipse (you can probably just google for those directions).

@ttung
Copy link
Contributor

ttung commented Sep 18, 2014

@TommyVisic Conceptually, there is no reason why it shouldn't work w/ the android plugin. I'll need to investigate that though. Internally, we always keep the model classes in a separate package because the fields must be package-visible, and we don't want direct accesses.

@TommyVisic
Copy link

That makes sense about the package-visible issue.

FYI, when attempting to apply both plugins, Gradle reports: Error:The 'java' plugin has been applied, but it is not compatible with the Android plugins.

@ttung
Copy link
Contributor

ttung commented Sep 18, 2014

Yeah, you can't apply both plugins. What I meant was: It might not be compatible at the moment, but I don't think it's fundamentally incompatible. :)

@ttung
Copy link
Contributor

ttung commented Sep 18, 2014

I'm going to close this issue because it's become a dumping ground for various issues.

@ttung ttung closed this as completed Sep 18, 2014
@ttung
Copy link
Contributor

ttung commented Sep 18, 2014

Opening a new "documentation + wiki" issue as #12

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants