cppfw / svgren

:camera: SVG rendering library in C++
MIT License
206 stars 41 forks source link

Android install #74

Closed oziphantom closed 4 years ago

oziphantom commented 4 years ago

So I'm trying to get this working on android. Windows and iOS no problems, they have sane sensible run this application and it will download things and you never have to touch it again solutions.

So Following the 3rd step of https://github.com/howardpang/androidNativeBundle which I think is the one for "I want to use something that uses this" rather than "I want to make my thing so it deploys via this". I found a clearer version here https://github.com/WanghongLin/OpenCV4Android which mostly matches up.

Then you have https://github.com/igagis/pravila/blob/master/EnableRepoAndroid.adoc to which "right next to dependencies" do you mean Under it, inside it?

I eventually get to ( after adding the rest of the bits in the other files )

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project(':libcocos2dx')
    repositories {
        maven {
            url 'https://dl.bintray.com/igagis/android/'
        }
    }
}

Which doesn't actually download or do anything it seems.

Then I start to ponder what one is to do with 'io.github.igagis:svgren' so I add it like so

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project(':libcocos2dx')
    repositories {
        maven {
            url 'https://dl.bintray.com/igagis/android/'
        }
    }
    implementation( 'io.github.igagis:svgren')
}

Still nothing. After more web searches I hit upon https://stackoverflow.com/questions/21814652/how-to-download-dependencies-in-gradle see the Intellij answer with 15 votes. I find the magic refresh button.. that apparently means download stuff. Well it would except

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':Ouille'.
    ...
Caused by: org.gradle.api.artifacts.ResolveException: Could not resolve all dependencies for configuration ':Ouille:debugCompileClasspath'.
    ...
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException: Could not find io.github.igagis:svgren:.
Required by:
    project :Ouille
    at org.gradle.internal.resolve.result.DefaultBuildableComponentResolveResult.notFound(DefaultBuildableComponentResolveResult.java:42)
    ...

So how does one use 'io.github.igagis:svgren' to get svgren into a project?

igagis commented 4 years ago

Hi,

by "right next to dependencies" I meant this:

repositories {
    maven {
        url 'https://dl.bintray.com/igagis/android/'
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project(':libcocos2dx')
    implementation 'io.github.igagis:svgren:+'
}

i.e. not inside of dependencies, but next to it.

Note, the + in svgren dependency declaration means "download latest version", instead of + one could use exact version number, e.g. 0.4.71. After that, when you start building your app it will download all the dependencies automatically.

Note, that when using +, once downloaded, the packages are not updated anymore, i.e. if new version of the package comes out it will not update to the newest version. To make it update one has to clean the gradle caches. For example on linux it is done by removing caches directory rm -rf ~/.gradle/caches.

oziphantom commented 4 years ago

I've made the changes, errors msgs have changed, but I need to work out how to fix other things before I can declare this "working". It looks promising though.

While I am here: A B C D

A is before B,A is above B, C is next to B, D is after C. B is before C, D is below B, D is under B. So next means this

dependencies { repositories {
    maven {
        url 'https://dl.bintray.com/igagis/android/'
    }
}
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project(':libcocos2dx')
    implementation 'io.github.igagis:svgren:+'
}

i.e repositories is next to dependencies.

repositories {
    maven {
        url 'https://dl.bintray.com/igagis/android/'
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project(':libcocos2dx')
    implementation 'io.github.igagis:svgren:+'
}

is repositories is before, or above dependencies.

igagis commented 4 years ago

@oziphantom By 'next to something' I mean 'near to something', that's how it is in English, isn't it? Also, the next thing can be next in vertical order as well, not only horizontal. But anyway, repositories and dependencies items have curly braces, which enclose the contents of those items. I.e. everything inside of those curly braces is inside of repositories or dependencies.

In your last sample:

repositories {
    maven {
        url 'https://dl.bintray.com/igagis/android/'
    }
}
dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project(':libcocos2dx')
    implementation 'io.github.igagis:svgren:+'
}

The repositories item is next to (near to) dependencies, but it is also above the dependencies and it is also before dependencies, all those statements are valid.

In your first example:

dependencies { repositories {
    maven {
        url 'https://dl.bintray.com/igagis/android/'
    }
}
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation project(':libcocos2dx')
    implementation 'io.github.igagis:svgren:+'
}

The repositories item is inside of dependencies item.

Let me know if you are not able to fix errors you see after you changed the repositories/dependencies thing.

oziphantom commented 4 years ago

English is very context sensitive. If we are talking about two people standing in a field with nothing else, the person A is next to person B and person B is next to person A. And the angle relative to the sun between them can be anything as there is nothing to anchor or give you a frame of reference. 'Next Thing' implies there is an order, or a list, to which reading in English gives left to right, top to bottom. so if you have A B C D B is the next thing after A, C is the next thing after B , D is the next thing after C. 'Next Thing' != 'Next To'. Thing is based upon order, To is based upon position.

The repositories item is next to (near to) dependencies,
but it is also above the dependencies and it is also before dependencies, 
all those statements are valid.

No, its above, or before. 'next to' implies that they are horizontally aligned. And since English is a Left to Right language you say the right most is next to left item . subjectObject relation otherObject. So above, B and C are next to each other, A is not next to anything, D is not next to anything. So B C C is next to B. While B is also next to C, you don't say it, as it goes against the normal order. As in if you say B is next to C , people will assume C B If something is right above, you say before. A B C so you do B before C. While is A is above C. I.e A just has to be declared sometime before C is. But these terms are "loose" so you tend to clarify with "right" so B is right above C or B is directly above C. While A is somewhere before C if it doesn't matter, as long as it is just before. Another point of confusion. you can say "Next in" an order. So B is next in line, B is next, B is next after A. English is hard, almost as hard as the Android build system ;)

igagis commented 4 years ago

Thanks for English grammar course :)!

Well, It actually does not matter if repositories goes above or below dependencies, gradle is declarative language in that sense. So this is why I used 'next to' meaning somewhere in the same scope as dependencies item, as it does not matter if it goes before or after or even directly adjacent to. Same as two people standing in the field :).

Anyway, I have made corrections to https://github.com/igagis/pravila/blob/master/EnableRepoAndroid.adoc and removed the 'next to' figure, and now it has the example snipped which shows how it should look and I think now there will be less confusions about it.

Android build system is not hard, it is terrible! I hate it, but have to deal with it.

Let me know if you have other errors you'd need help with, but open a separate issue for those.

saeitsystems commented 4 years ago

I would suggest using German as conversation language ....... a lot of complex possibilities and exceptions to learn. And very easy to understand for me ;-)