Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

make this to library project #1012

Open
jacksonej opened this issue Oct 5, 2017 · 12 comments
Open

make this to library project #1012

jacksonej opened this issue Oct 5, 2017 · 12 comments
Labels
wontfix This will not be worked on

Comments

@jacksonej
Copy link

Hi,
How can i make this project into a library project

@jacksonej jacksonej changed the title edx app as a library project make this to library project Oct 5, 2017
@miankhalid
Copy link
Contributor

Whats your use-case? and why do you need this full fledge project to be a library project/module?

@gh-23378
Copy link

I am actually in the same boat as Jackson, I am working on an app to help highschool students successfully transition to college and one of the requirements is that I embed Open edX inside of my app.

I ran through the usual steps (https://developer.android.com/studio/projects/android-library.html#Convert):

  • removed the applicationId
  • applied the com.android.library plugin
  • I also had to change android.applicationVariants.all to android.libraryVariants.all and copy buildSrc over to the root of the new project

I hit a wall with building my AAR though. Error:(15, 34) error: package org.edx.mobile.databinding does not exist. Do you have any advice on next steps?

@BenjiLee
Copy link
Contributor

I may have come across the databinding issue a long time again and I remember needed to recompile my project. https://stackoverflow.com/questions/40440662/databinding-does-not-exist-how-to-solve-it

@miankhalid @farhan Any experience on librarification?

@jacksonej
Copy link
Author

jacksonej commented Oct 19, 2017

Actually we have almost same requirement as @DevKate. First time we didn't have the requirement in our edx project. So we fully build it as a seperate project. Now we have to include this as a module in our project

we tried to recombile this project
error: package org.edx.mobile.databinding does not exist
but this error got us nowhere

@farhan
Copy link
Contributor

farhan commented Oct 19, 2017

@BenjiLee Nops didn't get a chance to work on librarification so far.
@MirzaMubasharBaig Will not it be a good idea to create a story of that and we can do research and resolve it in that.

@miankhalid
Copy link
Contributor

Same as @farhan in this case. Will have to invest some time into it.

@gh-23378
Copy link

I've made some progress. Because library resource ids are not constants, I had to remove all @InjectView and @ContentView annotations and replace them with calls to findViewById. I also had to replace a few switch statements with if/else for the same reason.

A few other changes I made were:

  • updating from org.apache.commons.lang to org.apache.commons.lang3
  • changing provided to annotationProcessor for roboguice:roboblender
  • adding vectorDrawables.useSupportLibrary = true to the defaultConfig in OpenEdXMobile/build.gradle
  • adding a default flavor dimension

Databinding errors are gone and I am able to generate dev and prod AARs. My current issue is loading those AARs as dependencies from my main application. I used android studio's "Import Module From Library" to add the AAR to my project, but when I included it as a dependency in my application module implementation project(':OpenEdXMobile'), I got this error:

Error:Could not determine the dependencies of task ':OpenEdXMobile:compileProdDebuggableJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':OpenEdXMobile:prodDebuggableCompileClasspath'.
   > Could not resolve project :android-iconify.
     Required by:
         project :OpenEdXMobile
      > Unable to find a matching configuration of project :android-iconify:
          - Configuration 'debugApiElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'debuggable' and found incompatible value 'debug'.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
              - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
              - Required default 'prod' but no value provided.
              - Required org.gradle.api.attributes.Usage 'java-api' and found compatible value 'java-api'.
          - Configuration 'debugRuntimeElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'debuggable' and found incompatible value 'debug'.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
              - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
              - Required default 'prod' but no value provided.
              - Required org.gradle.api.attributes.Usage 'java-api' and found incompatible value 'java-runtime'.
          - Configuration 'releaseApiElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'debuggable' and found incompatible value 'release'.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
              - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
              - Required default 'prod' but no value provided.
              - Required org.gradle.api.attributes.Usage 'java-api' and found compatible value 'java-api'.
          - Configuration 'releaseRuntimeElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'debuggable' and found incompatible value 'release'.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
              - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
              - Required default 'prod' but no value provided.
              - Required org.gradle.api.attributes.Usage 'java-api' and found incompatible value 'java-runtime'.
   > Could not resolve project :android-iconify-fontawesome.
     Required by:
         project :OpenEdXMobile
      > Unable to find a matching configuration of project :android-iconify-fontawesome:
          - Configuration 'debugApiElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'debuggable' and found incompatible value 'debug'.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
              - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
              - Required default 'prod' but no value provided.
              - Required org.gradle.api.attributes.Usage 'java-api' and found compatible value 'java-api'.
          - Configuration 'debugRuntimeElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'debuggable' and found incompatible value 'debug'.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
              - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
              - Required default 'prod' but no value provided.
              - Required org.gradle.api.attributes.Usage 'java-api' and found incompatible value 'java-runtime'.
          - Configuration 'releaseApiElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'debuggable' and found incompatible value 'release'.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
              - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
              - Required default 'prod' but no value provided.
              - Required org.gradle.api.attributes.Usage 'java-api' and found compatible value 'java-api'.
          - Configuration 'releaseRuntimeElements':
              - Required com.android.build.api.attributes.BuildTypeAttr 'debuggable' and found incompatible value 'release'.
              - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
              - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
              - Required default 'prod' but no value provided.
              - Required org.gradle.api.attributes.Usage 'java-api' and found incompatible value 'java-runtime'.

My friend suggested I try adding matchingFallbacks = ['debug', 'release'] to android.buildTypes.debug, but then the aar failed to build with this error Could not set unknown property 'matchingFallbacks' for BuildType_Decorated

@BenjiLee
Copy link
Contributor

@marcotuts FYI

@marcotuts
Copy link

@DevKate Is this the kind of work that would be ok to open a WIP pull request to get early feedback / comments on? If so we can move discussion to a PR instead of this github issue. .

@gh-23378
Copy link

gh-23378 commented Nov 7, 2017

Sorry to leave you hanging @marcotuts, PR sounds like a great idea. It sounds like requirements for this project may potentially allow installing the edx dependency as a separate apk, in which case my issue will shift from compiling openedx as a library to interfacing with the openedx apk from my main application. This would likely result in some custom code to handle authentication from the main app when the edx apk is launched, and some changes to the manifest to launch the app at specific activities. The goal is just to allow students to take their classes from our app. Not sure if this would also satisfy @jacksonej's issue. I was thinking of creating a fork for an embeddable version of openedx if my company does opt for this solution instead of librification, unless you'd prefer we make a PR and support this use case from the main project.

@BenjiLee
Copy link
Contributor

BenjiLee commented Nov 8, 2017

@staubina FYI

@staubina
Copy link
Contributor

staubina commented Nov 8, 2017

@BenjiLee Thank you for the heads up on this.

@kdmccormick kdmccormick added the wontfix This will not be worked on label May 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

8 participants