Code Monkey home page Code Monkey logo

android-example's Introduction

android-example

Release

Example Android library project that works with jitpack.io.

See this Tutorial on how to publish an Android Library with JitPack.

For more details check out the documentation

https://jitpack.io/#jitpack/android-example

Add it to your build.gradle with:

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
    }
}

and:

dependencies {
    compile 'com.github.jitpack:android-example:{latest version}'
}

Multiple build variants

If your library uses multiple flavours then see this example: https://github.com/jitpack-io/android-jitpack-library-example

Adding the maven plugin

To enable installing into local maven repository and JitPack you need to add the android-maven plugin:

  1. Add classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' to root build.gradle under buildscript { dependencies {
  2. Add com.github.dcendents.android-maven to the library/build.gradle

After these changes you should be able to run:

./gradlew install

from the root of your project. If install works and you have added a GitHub release it should work on jitpack.io

Adding a sample app

If you add a sample app to the same repo then your app needs to have a dependency on the library. To do this in your app/build.gradle add:

    dependencies {
        compile project(':library')
    }

android-example's People

Contributors

hannesa2 avatar jawnnypoo avatar jitpack-io avatar larsgrefer avatar paolorotolo avatar pluscubed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

android-example's Issues

Not work with Gradle 7.0

Error log on Jitpack.io

  • What went wrong:
    An exception occurred applying plugin request [id: 'com.android.application']

Failed to apply plugin 'com.android.internal.application'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing org.gradle.java.home in gradle.properties.

Adding the maven plugin

hello,After I do this,there are some problems
like this:
can not find android-maven-gradle-plugin in 'D:\software\Android Studio\gradle\m2repository\com...'
I don't know how to solve.

Android 12(31) version + Java 11 Environment issue with jitpack

In jitpack.yml file have below content

jdk:

  • openjdk11
    install:
  • ./gradlew build :lib:publishToMavenLocal

Error Report Log from jit pack build version

Date: Mon Dec 13 19:16:32 2021 +0530

4.0.21v jitpack with 11 issue is resolved

Found Android manifest
Android SDK version: 31. Build tools: 31.0.0
Installing Android platform 31
Installing Build-tools 31.0.0
Going into directory: ./FFSpinSDK
Gradle build script
Found gradle version: 7.0.2.
Using gradle wrapper
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Downloading https://services.gradle.org/distributions/gradle-7.0.2-bin.zip
.
Unzipping /home/jitpack/.gradle/wrapper/dists/gradle-7.0.2-bin/857tjihv64xamwrf0h14cai3r/gradle-7.0.2-bin.zip to /home/jitpack/.gradle/wrapper/dists/gradle-7.0.2-bin/857tjihv64xamwrf0h14cai3r
Set executable permissions for: /home/jitpack/.gradle/wrapper/dists/gradle-7.0.2-bin/857tjihv64xamwrf0h14cai3r/gradle-7.0.2/bin/gradle


Gradle 7.0.2

Build time: 2021-05-14 12:02:31 UTC
Revision: 1ef1b260d39daacbf9357f9d8594a8a743e2152e

Kotlin: 1.4.31
Groovy: 3.0.7
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 1.8.0_252 (Private Build 25.252-b09)
OS: Linux 4.10.0-28-generic amd64

0m3.152s
Getting tasks: ./gradlew tasks --all
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2

FAILURE: Build failed with an exception.

  • Where:
    Build file '/home/jitpack/build/FFSpinSDK/app/build.gradle' line: 2

  • What went wrong:
    An exception occurred applying plugin request [id: 'com.android.application']

Failed to apply plugin 'com.android.internal.application'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing org.gradle.java.home in gradle.properties.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 13s
Tasks:

WARNING:
Gradle 'install' task not found. Please add the 'maven' or 'android-maven' plugin.
See the documentation and examples: https://jitpack.io/docs/

Adding maven plugin
Found android library build file in ffspinapi
Found android library build file in ffspinapi
Running: ./gradlew clean -Pgroup=com.github.flickfusion -Pversion=4.0.21 install
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2

Configure project :
Gradle version Gradle 7.0.2

FAILURE: Build failed with an exception.

  • Where:
    Build file '/home/jitpack/build/FFSpinSDK/app/build.gradle' line: 2

  • What went wrong:
    An exception occurred applying plugin request [id: 'com.android.application']

Failed to apply plugin 'com.android.internal.application'.
Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing org.gradle.java.home in gradle.properties.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 855ms
Build tool exit code: 0
Looking for artifacts...
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Dhttps.protocols=TLSv1.2
Looking for pom.xml in build directory and ~/.m2
2021-12-13T13:50:01.374397374Z
Exit code: 0

ERROR: No build artifacts found

Use of deprecated method in buildscript

The build.gradle file contains these lines at the bottom:

android.libraryVariants.all { variant ->
    def name = variant.buildType.name
    def task = project.tasks.create "jar${name.capitalize()}", Jar
    task.dependsOn variant.javaCompile
    task.from variant.javaCompile.destinationDir
    artifacts.add('archives', task)
}

All instances of varient.javaCompile should be replaced with varient.javaCompiler because the former is deprecated.

URL cannot be resolved

Hello!

After adding the required code snippets no my gradle files in Android Studio, the build failed with message : cannot resolve com.github.jitpack (and so on)

Whats the problem? I added the maven repo to allprojects - repos in project build.gradle, and the implementation for GitHub url in the module build.gradle
(Same problem I had with my own jitpack project, so I imported this, but is doesnt work, too.

‘ClassNotFoundException’ after Android build

I built this project ‘https://github.com/weimingjue/TakePhoto/tree/maven_error_test’ using ‘https://jitpack.io’, and this is the test version after the build ‘com.github.weimingjue:TakePhoto:0.0.1’. I used Android Studio to depend on this version and build an Android package without any errors or warnings, but when my code executed into this library, I encountered a ‘ClassNotFoundException’. I found that the TakePhoto library can be used normally, but all the dependencies it references have not been built correctly, resulting in the inability to find other libraries referenced. After troubleshooting, I found that it was mainly caused by this aar library in the pom file ‘implementation ‘com.soundcloud.android:android-crop:1.0.1@aar’’. I tried to use my own pom file, but the pom built was not replaced. I don’t know what to do now. How can I use this library?’

How do you setup jitpack to handle multi-module projects?

Let's say I had 3 modules in my Android project:

Core - contains shared code for other modules.
API - contains all the networking logic. Relies on Core
MyLib - contains some views and other logic. Relies on API and Core

I want to allow a user of my library to either use MyLib or just API (if they wanted to do everything themselves). How do I go about publishing this on jitpack to do that?

Specifying build variants

Hi there @jitpack-io ,

is it possible to specify a build variant to be generated the library using jitpack?

In my library I have two build variants (for example, sandbox and production), how can I specify which of them I want to build?

Thanks

I cant cancel my subscription to jitpack.io!

I want to cancel my subscription to jitpack.io, but it is not displayed in my account! Support has not responded for many months! While the money is debited monthly! Email me asap!

missing variable

My build needs a variable (it's out of my control to remove it) and a specific NDK, but jitpack.io don't know anything about.
https://jitpack.io/com/github/hannesa2/android-database-sqlcipher/4.2.0.0/build.log
How can I specify it ?

In the same repo I prepared a travis build with this variable https://github.com/hannesa2/android-database-sqlcipher/blob/6ab61dc90a36d62fd57c62c446fba9d9315a6bd1/.travis.yml#L37
But as it looks like Travis and jitpack.io are different things

I see in doku to add a jitpack.yml

jdk:
  - openjdk9
before_install:
  - ./custom_setup.sh
install:
  - ./gradlew clean install -xtest
env:
  ANDROID_NDK_ROOT : `pwd`/android-ndk-r15c
  PATH : ${PATH}:$ANDROID_NDK_ROOT

but this doesn't work.

Build starting...
/script/buildit.sh: line 3: date: command not found
/script/buildit.sh: line 3: hostname: command not found
Start:
Git:
/script/buildit.sh: line 5: git: command not found
/script/buildit.sh: line 6: git: command not found
/script/buildit.sh: line 6: head: command not found
/script/buildit.sh: line 6: cut: command not found

/script/buildit.sh: line 11: cp: command not found
/script/buildit.sh: line 12: cd: /home/jitpack/build: No such file or directory
/script/buildit.sh: line 19: dirname: command not found
/script/buildit.sh: line 27: find: command not found
Running before_install command:
./custom_setup.sh
./custom_setup.sh: line 1: wget: command not found
./custom_setup.sh: line 2: unzip: command not found
Running install command:
echo "Running a custom install command";./gradlew clean install -xtest
Running a custom install command
/usr/bin/env: ‘sh’: No such file or directory
Build tool exit code: 0
/script/buildit.sh: line 106: cp: command not found
Looking for artifacts...
/script/buildit.sh: line 110: gradle: command not found
/script/buildit.sh: line 111: gradle: command not found
2019-06-21T09:17:48.791934217Z
Exit code: 0

ERROR: No build artifacts found

This is my code https://github.com/hannesa2/android-database-sqlcipher/tree/jitpack

Can you show me an example which is working ?

Request for clarifications in the README

Hi there! Wondering if you can clarify some of the required steps to get this to work with Android - I've been fighting with this for some time and I still can't quite seem to get it to work.

  • Does the project you wish to use for creating the lib need to be in the root of the repo, or can it be in a secondary folder?
  • Can I use the include:library notation in my settings.gradle file, or do I need to use direct file references as shown here?
  • Where do I run gradle install - on the project where I've created the library, or on the project where I'm attempting to add the library?
  • Does the android-maven plugin need to be applied to both the project where I've created the library, the project where I'm attempting to add the library, or both?

Any clarifications on any of these would be most helpful. It would be really helpful if you could update the README to give a step-by-step set of instructions as to how to set up your repo so that jitpack will recognize it - I feel like I'm missing something big here. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.