FolioReader / FolioReader-Android

A Java ePub reader and parser framework for Android.
BSD 3-Clause "New" or "Revised" License
2.25k stars 718 forks source link

How to use as git submodule? #316

Open paulocoutinhox opened 5 years ago

paulocoutinhox commented 5 years ago

Hi,

I cloned into our vendor directory:

git submodule add [url] vendor/folio-reader

After, i have assed to settings.gradle:

include ':folio-reader'
project(':folio-reader').projectDir = file("../vendor/folio-reader")

After, i have added to dependencies:

implementation project(':folioreader')

But i got error:

Unable to resolve dependency for ':app@ubookDebug/compileClasspath': Could not resolve project :folioreader.

image

Can someone help me use it as git submodule?

Thanks.

paulocoutinhox commented 5 years ago

Hi,

I try use it as local dependency:

1 - I have modified installv1 file to use a different version name "0.5.1.internal". 2 - I run "./gradlew install" on root folder 3 - I put in my gradle:

repositories {
    mavenLocal()
    ...
} 

...

dependencies {
    implementation 'com.folioreader:folioreader:0.5.1.internal@aar'
}

It is syncing, building and compiling.

But when i run, i got the same problem:

     Caused by: java.lang.ClassNotFoundException: Didn't find class "org.readium.r2.shared.Publication$EXTENSION" on path: DexPathList[[zip file "/data/app/br.com.ubook.ubookapp-2/base.apk"],nativeLibraryDirectories=[/data/app/br.com.ubook.ubookapp-2/lib/arm, /data/app/br.com.ubook.ubookapp-2/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]

Can anyone help me?

hrishikesh-kadam commented 5 years ago

Just remove @aar

paulocoutinhox commented 5 years ago

Hi,

If i remove i get error:

More than one file was found with OS independent path 'META-INF/nanohttpd/default-mimetypes.properties'

Because this i use @aar. How i can solve it?

hrishikesh-kadam commented 5 years ago

I hope when you are importing through mavenLocal() you are replacing following line -

implementation project(':folioreader')

with -

implementation 'com.folioreader:folioreader:0.5.1.internal'
paulocoutinhox commented 5 years ago

Yes, it is:

implementation 'com.folioreader:folioreader:0.5.1.internal'

Like i sad in https://github.com/FolioReader/FolioReader-Android/issues/310

But it is throwing that error.

paulocoutinhox commented 5 years ago

After use this lines in my app:

android {
...
    packagingOptions {
        pickFirst 'META-INF/nanohttpd/default-mimetypes.properties'
        pickFirst 'META-INF/nanohttpd/mimetypes.properties'
    }
...
}

I got error:

2018-12-18 14:08:44.411 3981-3981/br.com.ubook.ubookapp E/AndroidRuntime: FATAL EXCEPTION: main
    Process: br.com.ubook.ubookapp, PID: 3981
    android.view.InflateException: Binary XML file line #28: Binary XML file line #28: Error inflating class com.folioreader.view.LoadingView
    Caused by: android.view.InflateException: Binary XML file line #28: Error inflating class com.folioreader.view.LoadingView
    Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance0(Native Method)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
        at android.view.LayoutInflater.createView(LayoutInflater.java:652)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:865)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:828)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:525)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
        at com.folioreader.ui.folio.fragment.FolioPageFragment.onCreateView(FolioPageFragment.java:183)
        at android.support.v4.app.Fragment.performCreateView(Fragment.java:2439)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
        at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
        at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
        at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:802)
        at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
        at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
        at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
        at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:2243)
        at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:654)
        at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:168)
        at com.folioreader.view.DirectionalViewpager.populate(DirectionalViewpager.java:1327)
        at com.folioreader.view.DirectionalViewpager.populate(DirectionalViewpager.java:1105)
        at com.folioreader.view.DirectionalViewpager.onMeasure(DirectionalViewpager.java:1828)
        at android.view.View.measure(View.java:21291)
        at android.support.constraint.ConstraintLayout.onMeasure(ConstraintLayout.java:1676)
        at android.view.View.measure(View.java:21291)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6443)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
        at android.view.View.measure(View.java:21291)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6443)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
        at android.view.View.measure(View.java:21291)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6443)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.view.View.measure(View.java:21291)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6443)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
        at android.view.View.measure(View.java:21291)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6443)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at com.android.internal.policy.DecorView.onMeasure(DecorView.java:916)
        at android.view.View.measure(View.java:21291)
        at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2639)
2018-12-18 14:08:44.414 3981-3981/br.com.ubook.ubookapp E/AndroidRuntime:     at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1697)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1952)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1569)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7296)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:930)
        at android.view.Choreographer.doCallbacks(Choreographer.java:705)
        at android.view.Choreographer.doFrame(Choreographer.java:640)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:916)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6823)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1563)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1451)
     Caused by: java.lang.NoSuchFieldError: No static field progressBar of type I in class Lcom/folioreader/R$id; or its superclasses (declaration of 'com.folioreader.R$id' appears in /data/app/br.com.ubook.ubookapp-1/base.apk)
        at com.folioreader.view.LoadingView.init(LoadingView.java:63)
        at com.folioreader.view.LoadingView.<init>(LoadingView.java:41)
            ... 64 more
paulocoutinhox commented 5 years ago

Can anyone help me?

paulocoutinhox commented 5 years ago

@hrishikesh-kadam Please, help me integrate it.

hrishikesh-kadam commented 5 years ago

@prsolucoes Please download this zip file https://drive.google.com/open?id=1qbfEZ_nWZK4BsKhlsWuD0xpJ8CoOGCJG

I have tried to mock a project structure like yours. Important steps to get started for you will be -

  1. Change publishedGroupId and artifact, like I did in RootFolder\vendor\FolioReader-Android\folioreader\build.gradle
  2. Run gradlew install on this path - RootFolder\vendor\FolioReader-Android. This will generate all the necessary files like .aar, .pom, etc in your {user}\m2\respository\com\ubook\folioreader\0.5.1.internal
  3. Now add mavenLocal() and jitpack maven url like I did in RootFolder\MyApplication\build.gradle
  4. Add multidex support in your app module. You can read it more here - https://developer.android.com/studio/build/multidex, also I have enabled multidex in attached project.
  5. Lastly just see how I added implementation statement in RootFolder\MyApplication\app\build.gradle

In short, what this does is publishes your modified FolioReader locally and imports it through gradle using mavenLocal() repo.

Also please close #310, let's have conversation on this issue.

paulocoutinhox commented 5 years ago

Ok, we are focusing on it again now. I will post here the results.

saptha commented 4 years ago

@prsolucoes Please download this zip file https://drive.google.com/open?id=1qbfEZ_nWZK4BsKhlsWuD0xpJ8CoOGCJG

I have tried to mock a project structure like yours. Important steps to get started for you will be -

  1. Change publishedGroupId and artifact, like I did in RootFolder\vendor\FolioReader-Android\folioreader\build.gradle
  2. Run gradlew install on this path - RootFolder\vendor\FolioReader-Android. This will generate all the necessary files like .aar, .pom, etc in your {user}\m2\respository\com\ubook\folioreader\0.5.1.internal
  3. Now add mavenLocal() and jitpack maven url like I did in RootFolder\MyApplication\build.gradle
  4. Add multidex support in your app module. You can read it more here - https://developer.android.com/studio/build/multidex, also I have enabled multidex in attached project.
  5. Lastly just see how I added implementation statement in RootFolder\MyApplication\app\build.gradle

In short, what this does is publishes your modified FolioReader locally and imports it through gradle using mavenLocal() repo.

Also please close #310, let's have conversation on this issue.

Hi @hrishikesh-kadam , The drive url is not accessible and so we cannot see the sample code you did. Can you please give sample for how you did the steps 1 and 3 above.