Build tools update (#911)
* Improve #877 * Update pull_request_template.md * Update gradle version * Update AGP version * Update build files, use MavenPublisher plugin * Add FAQs * Fix testspull/912/head
parent
66c37373bd
commit
a7c18324a5
@ -1,10 +1,14 @@ |
|||||||
### Before you go |
### Before you go |
||||||
Unless this is a simple fix (typos, bugs with obvious solution), please open an issue first. |
Unless this is a simple fix (typos, bugs with obvious solution), please open an issue first so that |
||||||
If the edited files were covered by tests, updated tests are required for merging. Please look into the tests folders and make sure you cover new code. |
we can discuss the best approach to address the problem. Without a reference issue and discussion, |
||||||
|
unfortunately, this PR will likely be ignored. |
||||||
|
|
||||||
|
If the edited files were covered by tests, updated tests are required for merging. |
||||||
|
Please look into the tests folders and make sure you cover new code. |
||||||
|
|
||||||
- Fixes ... (*issue number*) |
- Fixes ... (*issue number*) |
||||||
- Tests: ... (*yes/no*) |
- Tests: ... (*yes/no*) |
||||||
- Docs updated: ... (*yes/no*) |
- Docs updated: ... (*yes/no*) |
||||||
|
|
||||||
### Solution |
### Solution |
||||||
If applicable, briefly describe how the issue was addressed. |
If applicable, describe briefly how the issue was addressed. |
||||||
|
@ -1,29 +0,0 @@ |
|||||||
buildscript { |
|
||||||
repositories { |
|
||||||
jcenter() |
|
||||||
google() |
|
||||||
} |
|
||||||
|
|
||||||
dependencies { |
|
||||||
classpath 'com.android.tools.build:gradle:3.5.3' |
|
||||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' |
|
||||||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
allprojects { |
|
||||||
repositories { |
|
||||||
jcenter() |
|
||||||
google() |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
ext { |
|
||||||
compileSdkVersion = 29 |
|
||||||
minSdkVersion = 15 |
|
||||||
targetSdkVersion = 29 |
|
||||||
} |
|
||||||
|
|
||||||
task clean(type: Delete) { |
|
||||||
delete rootProject.buildDir |
|
||||||
} |
|
@ -0,0 +1,34 @@ |
|||||||
|
|
||||||
|
buildscript { |
||||||
|
|
||||||
|
extra["minSdkVersion"] = 15 |
||||||
|
extra["compileSdkVersion"] = 29 |
||||||
|
extra["targetSdkVersion"] = 29 |
||||||
|
extra["kotlinVersion"] = "1.3.72" |
||||||
|
|
||||||
|
repositories { |
||||||
|
google() |
||||||
|
mavenCentral() |
||||||
|
jcenter() |
||||||
|
} |
||||||
|
|
||||||
|
dependencies { |
||||||
|
classpath("com.android.tools.build:gradle:4.0.0") |
||||||
|
classpath("com.otaliastudios.tools:publisher:0.3.3") |
||||||
|
val kotlinVersion = property("kotlinVersion") as String |
||||||
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
allprojects { |
||||||
|
repositories { |
||||||
|
google() |
||||||
|
mavenCentral() |
||||||
|
jcenter() |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
tasks.register("clean", Delete::class) { |
||||||
|
delete(buildDir) |
||||||
|
} |
@ -1,271 +0,0 @@ |
|||||||
apply plugin: 'com.android.library' |
|
||||||
apply plugin: 'com.github.dcendents.android-maven' |
|
||||||
apply plugin: 'com.jfrog.bintray' |
|
||||||
|
|
||||||
// Required by bintray |
|
||||||
version = '2.6.2' |
|
||||||
group = 'com.otaliastudios' |
|
||||||
|
|
||||||
//region android dependencies |
|
||||||
|
|
||||||
android { |
|
||||||
compileSdkVersion rootProject.ext.compileSdkVersion |
|
||||||
|
|
||||||
defaultConfig { |
|
||||||
minSdkVersion rootProject.ext.minSdkVersion |
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion |
|
||||||
versionCode 1 |
|
||||||
versionName project.version |
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
|
||||||
testInstrumentationRunnerArgument "filter", "" + |
|
||||||
"com.otaliastudios.cameraview.tools.SdkExcludeFilter," + |
|
||||||
"com.otaliastudios.cameraview.tools.SdkIncludeFilter" |
|
||||||
} |
|
||||||
|
|
||||||
buildTypes { |
|
||||||
debug { |
|
||||||
testCoverageEnabled true |
|
||||||
} |
|
||||||
|
|
||||||
release { |
|
||||||
minifyEnabled false |
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
dependencies { |
|
||||||
testImplementation 'junit:junit:4.12' |
|
||||||
testImplementation 'org.mockito:mockito-inline:2.28.2' |
|
||||||
|
|
||||||
androidTestImplementation 'androidx.test:runner:1.2.0' |
|
||||||
androidTestImplementation 'androidx.test:rules:1.2.0' |
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.1' |
|
||||||
androidTestImplementation 'org.mockito:mockito-android:2.28.2' |
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' |
|
||||||
|
|
||||||
api 'androidx.exifinterface:exifinterface:1.1.0' |
|
||||||
api 'androidx.lifecycle:lifecycle-common:2.1.0' |
|
||||||
api 'com.google.android.gms:play-services-tasks:17.0.0' |
|
||||||
implementation 'androidx.annotation:annotation:1.1.0' |
|
||||||
implementation 'com.otaliastudios.opengl:egloo:0.4.0' |
|
||||||
} |
|
||||||
|
|
||||||
//endregion |
|
||||||
|
|
||||||
//region bintray |
|
||||||
|
|
||||||
// install is a task defined by the Gradle Maven plugin, which is used to |
|
||||||
// publish a maven repo to a local repository. (we actually use the android version of the plugin, |
|
||||||
// com.github.dcendents.android-maven, to support AARs) |
|
||||||
// https://docs.gradle.org/current/userguide/maven_plugin.html#sec:maven_tasks |
|
||||||
install { |
|
||||||
// The repositories property is common to all tasks of type Upload and returns the repositories |
|
||||||
// into which we will upload data. https://docs.gradle.org/current/dsl/org.gradle.api.tasks.Upload.html#org.gradle.api.tasks.Upload:repositories |
|
||||||
// It returns a RepositoryHandler: https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.dsl.RepositoryHandler.html |
|
||||||
repositories { |
|
||||||
// The maven plugin adds a mavenInstaller property to the RepositoryHandler which can be used to |
|
||||||
// add and configure a local maven repository cache. |
|
||||||
// https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.dsl.RepositoryHandler.html#N11785 |
|
||||||
mavenInstaller { |
|
||||||
// The object here extends PomFilterContainer so we can configure the pom file here. |
|
||||||
// https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/maven/PomFilterContainer.html#pom-groovy.lang.Closure- |
|
||||||
pom { |
|
||||||
// Now we are inside a MavenPom object that can be configured. We get the project and configure. |
|
||||||
// https://docs.gradle.org/current/javadoc/org/gradle/api/artifacts/maven/MavenPom.html |
|
||||||
project { |
|
||||||
name 'CameraView' |
|
||||||
description 'A well documented, high-level Android interface that makes capturing pictures ' + |
|
||||||
'and videos easy, addressing most of the common issues and needs.' |
|
||||||
url 'https://github.com/natario1/CameraView' |
|
||||||
packaging 'aar' |
|
||||||
groupId project.group |
|
||||||
artifactId 'cameraview' |
|
||||||
version project.version |
|
||||||
licenses { |
|
||||||
license { |
|
||||||
name 'The Apache Software License, Version 2.0' |
|
||||||
url 'http://www.apache.org/licenses/LICENSE-2.0.txt' |
|
||||||
} |
|
||||||
} |
|
||||||
scm { |
|
||||||
connection 'https://github.com/natario1/CameraView.git' |
|
||||||
developerConnection 'https://github.com/natario1/CameraView.git' |
|
||||||
url 'https://github.com/natario1/CameraView' |
|
||||||
|
|
||||||
} |
|
||||||
developers { |
|
||||||
developer { |
|
||||||
id = 'natario' |
|
||||||
name 'Mattia Iavarone' |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
def bintrayUser |
|
||||||
def bintrayKey |
|
||||||
def isCI = System.getenv("TRAVIS") |
|
||||||
if (isCI) { |
|
||||||
bintrayUser = System.getenv("BINTRAY_USER") |
|
||||||
bintrayKey = System.getenv("BINTRAY_KEY") |
|
||||||
} else { |
|
||||||
Properties props = new Properties() |
|
||||||
props.load(project.rootProject.file('local.properties').newDataInputStream()) |
|
||||||
bintrayUser = props.getProperty('bintray.user') |
|
||||||
bintrayKey = props.get('bintray.key') |
|
||||||
} |
|
||||||
|
|
||||||
bintray { |
|
||||||
// https://github.com/bintray/gradle-bintray-plugin |
|
||||||
user = bintrayUser |
|
||||||
key = bintrayKey |
|
||||||
configurations = ['archives'] |
|
||||||
pkg { |
|
||||||
repo = 'android' |
|
||||||
name = 'CameraView' |
|
||||||
licenses = ['Apache-2.0'] |
|
||||||
vcsUrl = 'https://github.com/natario1/CameraView.git' |
|
||||||
publish = true |
|
||||||
override = true |
|
||||||
version { |
|
||||||
name = project.version |
|
||||||
desc = 'CameraView v. '+project.version |
|
||||||
released = new Date() |
|
||||||
vcsTag = 'v'+project.version |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
//endregion |
|
||||||
|
|
||||||
//region javadoc and sources |
|
||||||
|
|
||||||
// From official sample https://github.com/bintray/bintray-examples/blob/master/gradle-aar-example/build.gradle |
|
||||||
task sourcesJar(type: Jar) { |
|
||||||
archiveClassifier.set('sources') |
|
||||||
from android.sourceSets.main.java.sourceFiles |
|
||||||
} |
|
||||||
|
|
||||||
task javadoc(type: Javadoc) { |
|
||||||
source = android.sourceSets.main.java.srcDirs |
|
||||||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) |
|
||||||
classpath += project.files("${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar") |
|
||||||
project.android.libraryVariants.all { variant -> |
|
||||||
if (variant.name == 'release') { |
|
||||||
classpath += files(variant.javaCompile.classpath) |
|
||||||
} |
|
||||||
} |
|
||||||
exclude '**/BuildConfig.java' |
|
||||||
exclude '**/R.java' |
|
||||||
// This excludes our internal folder, which is nice, but also creates |
|
||||||
// errors anytime we reference excluded classes in public classes javadocs, |
|
||||||
// which is unfortunate. There might be a fix but I don't know any. |
|
||||||
// exclude '**/internal/**' |
|
||||||
} |
|
||||||
|
|
||||||
task javadocJar(type: Jar, dependsOn: javadoc) { |
|
||||||
archiveClassifier.set('javadoc') |
|
||||||
from javadoc.destinationDir |
|
||||||
} |
|
||||||
|
|
||||||
artifacts { |
|
||||||
archives javadocJar |
|
||||||
archives sourcesJar |
|
||||||
} |
|
||||||
|
|
||||||
//endregion |
|
||||||
|
|
||||||
//region code coverage |
|
||||||
|
|
||||||
// 1. running androidTests with connectedCheck will generate an .ec file |
|
||||||
// in build/outputs/code-coverage/connected, plus the XML result in |
|
||||||
// in build/reports/coverage/debug/report.xml . |
|
||||||
|
|
||||||
// 2. running unit tests with testDebugUnitTest will just generate the .exec file. |
|
||||||
// The JacocoReport task from the jacoco plugin can create the XML report out of it. |
|
||||||
|
|
||||||
// to have a unified report, we just pass both the .exec and the .ec file |
|
||||||
// to the jacoco task, so we get a unified XML report with total coverage. |
|
||||||
// Reference: https://medium.com/@rafael_toledo/setting-up-an-unified-coverage-report-in-android-with-jacoco-robolectric-and-espresso-ffe239aaf3fa |
|
||||||
|
|
||||||
apply plugin: 'jacoco' |
|
||||||
|
|
||||||
def reportsDirectory = "$buildDir/reports/" |
|
||||||
jacoco { |
|
||||||
toolVersion = "0.8.1" |
|
||||||
reportsDir = file(reportsDirectory) |
|
||||||
} |
|
||||||
|
|
||||||
task createCoverageReports() { |
|
||||||
dependsOn "testDebugUnitTest" |
|
||||||
dependsOn "connectedCheck" |
|
||||||
} |
|
||||||
|
|
||||||
task mergeCoverageReports(type: JacocoReport) { |
|
||||||
// Let this be called without running the tests. |
|
||||||
// dependsOn "createCoverageReports" |
|
||||||
// However, ensure we have the compiled .class files. |
|
||||||
dependsOn "compileDebugSources" |
|
||||||
|
|
||||||
// Merge unit tests and android tests data |
|
||||||
executionData = fileTree(dir: "$buildDir", includes: [ |
|
||||||
"jacoco/testDebugUnitTest.exec", // Unit tests |
|
||||||
"outputs/code_coverage/debugAndroidTest/connected/*coverage.ec" // Android tests |
|
||||||
]) |
|
||||||
|
|
||||||
// Sources |
|
||||||
sourceDirectories = files(android.sourceSets.main.java.sourceFiles) |
|
||||||
additionalSourceDirs = files([ // Add BuildConfig and R. |
|
||||||
"$buildDir/generated/source/buildConfig/debug", |
|
||||||
"$buildDir/generated/source/r/debug" |
|
||||||
]) |
|
||||||
|
|
||||||
// Classes (.class files) |
|
||||||
// Not everything in the filter relates to CameraView, |
|
||||||
// but let's keep a generic filter |
|
||||||
def classDir = "$buildDir/intermediates/javac/debug" |
|
||||||
def classFilter = [ |
|
||||||
'**/R.class', |
|
||||||
'**/R$*.class', |
|
||||||
'**/BuildConfig.*', |
|
||||||
'**/Manifest*.*', |
|
||||||
'android/**', |
|
||||||
'androidx/**', |
|
||||||
'com/google/**', |
|
||||||
'**/*$ViewInjector*.*', |
|
||||||
'**/Dagger*Component.class', |
|
||||||
'**/Dagger*Component$Builder.class', |
|
||||||
'**/*Module_*Factory.class', |
|
||||||
] |
|
||||||
if (isCI) { |
|
||||||
// All these classes are tested by the integration tests that we are not able to |
|
||||||
// run on the CI emulator. |
|
||||||
// classFilter.add('**/com/otaliastudios/cameraview/engine/CameraEngine**.*') |
|
||||||
// classFilter.add('**/com/otaliastudios/cameraview/engine/Camera1Engine**.*') |
|
||||||
// classFilter.add('**/com/otaliastudios/cameraview/engine/Camera2Engine**.*') |
|
||||||
// classFilter.add('**/com/otaliastudios/cameraview/engine/action/**.*') |
|
||||||
// classFilter.add('**/com/otaliastudios/cameraview/engine/lock/**.*') |
|
||||||
// classFilter.add('**/com/otaliastudios/cameraview/engine/meter/**.*') |
|
||||||
// classFilter.add('**/com/otaliastudios/cameraview/picture/**.*') |
|
||||||
// classFilter.add('**/com/otaliastudios/cameraview/video/**.*') |
|
||||||
// classFilter.add('**/com/otaliastudios/cameraview/orchestrator/**.*') |
|
||||||
// classFilter.add('**/com/otaliastudios/cameraview/video/encoding/**.*') |
|
||||||
} |
|
||||||
// We don't test OpenGL filters. |
|
||||||
classFilter.add('**/com/otaliastudios/cameraview/filters/**.*') |
|
||||||
|
|
||||||
classDirectories = fileTree(dir: classDir, excludes: classFilter); |
|
||||||
|
|
||||||
reports.html.enabled = true |
|
||||||
reports.xml.enabled = true |
|
||||||
reports.xml.destination file("$reportsDirectory/mergedCoverageReport/report.xml") |
|
||||||
} |
|
||||||
|
|
||||||
//endregion |
|
||||||
|
|
||||||
// To deploy ./gradlew bintrayUpload |
|
||||||
|
|
@ -0,0 +1,125 @@ |
|||||||
|
import com.otaliastudios.tools.publisher.common.License |
||||||
|
import com.otaliastudios.tools.publisher.common.Release |
||||||
|
|
||||||
|
plugins { |
||||||
|
id("com.android.library") |
||||||
|
id("kotlin-android") |
||||||
|
id("com.otaliastudios.tools.publisher") |
||||||
|
id("jacoco") |
||||||
|
} |
||||||
|
|
||||||
|
android { |
||||||
|
setCompileSdkVersion(rootProject.property("compileSdkVersion") as Int) |
||||||
|
defaultConfig { |
||||||
|
setMinSdkVersion(rootProject.property("minSdkVersion") as Int) |
||||||
|
setTargetSdkVersion(rootProject.property("targetSdkVersion") as Int) |
||||||
|
versionCode = 1 |
||||||
|
versionName = "2.6.2" |
||||||
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" |
||||||
|
testInstrumentationRunnerArgument("filter", "" + |
||||||
|
"com.otaliastudios.cameraview.tools.SdkExcludeFilter," + |
||||||
|
"com.otaliastudios.cameraview.tools.SdkIncludeFilter") |
||||||
|
} |
||||||
|
buildTypes["debug"].isTestCoverageEnabled = true |
||||||
|
buildTypes["release"].isMinifyEnabled = true |
||||||
|
} |
||||||
|
|
||||||
|
dependencies { |
||||||
|
testImplementation("junit:junit:4.12") |
||||||
|
testImplementation("org.mockito:mockito-inline:2.28.2") |
||||||
|
|
||||||
|
androidTestImplementation("androidx.test:runner:1.2.0") |
||||||
|
androidTestImplementation("androidx.test:rules:1.2.0") |
||||||
|
androidTestImplementation("androidx.test.ext:junit:1.1.1") |
||||||
|
androidTestImplementation("org.mockito:mockito-android:2.28.2") |
||||||
|
androidTestImplementation("androidx.test.espresso:espresso-core:3.2.0") |
||||||
|
|
||||||
|
api("androidx.exifinterface:exifinterface:1.1.0") |
||||||
|
api("androidx.lifecycle:lifecycle-common:2.1.0") |
||||||
|
api("com.google.android.gms:play-services-tasks:17.0.0") |
||||||
|
implementation("androidx.annotation:annotation:1.1.0") |
||||||
|
implementation("com.otaliastudios.opengl:egloo:0.5.2") |
||||||
|
} |
||||||
|
|
||||||
|
// Publishing |
||||||
|
|
||||||
|
publisher { |
||||||
|
project.description = "A well documented, high-level Android interface that makes capturing " + |
||||||
|
"pictures and videos easy, addressing all of the common issues and needs. " + |
||||||
|
"Real-time filters, gestures, watermarks, frame processing, RAW, output of any size." |
||||||
|
project.artifact = "cameraview" |
||||||
|
project.group = "com.otaliastudios" |
||||||
|
project.url = "https://github.com/natario1/CameraView" |
||||||
|
project.addLicense(License.APACHE_2_0) |
||||||
|
release.setSources(Release.SOURCES_AUTO) |
||||||
|
release.setDocs(Release.DOCS_AUTO) |
||||||
|
bintray { |
||||||
|
auth.user = "BINTRAY_USER" |
||||||
|
auth.key = "BINTRAY_KEY" |
||||||
|
auth.repo = "BINTRAY_REPO" |
||||||
|
} |
||||||
|
directory { |
||||||
|
directory = "build/local" |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// Code Coverage |
||||||
|
val buildDir = project.buildDir.absolutePath |
||||||
|
val coverageInputDir = "$buildDir/coverage_input" // changing? change github workflow |
||||||
|
val coverageOutputDir = "$buildDir/coverage_output" // changing? change github workflow |
||||||
|
|
||||||
|
// Run unit tests, with coverage enabled in the android { } configuration. |
||||||
|
// Output will be an .exec file in build/jacoco. |
||||||
|
tasks.register("runUnitTests") { // changing name? change github workflow |
||||||
|
dependsOn("testDebugUnitTest") |
||||||
|
doLast { |
||||||
|
copy { |
||||||
|
from("$buildDir/jacoco/testDebugUnitTest.exec") |
||||||
|
into("$coverageInputDir/unit_tests") // changing? change github workflow |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// Run android tests with coverage. |
||||||
|
tasks.register("runAndroidTests") { // changing name? change github workflow |
||||||
|
dependsOn("connectedDebugAndroidTest") |
||||||
|
doLast { |
||||||
|
copy { |
||||||
|
from("$buildDir/outputs/code_coverage/debugAndroidTest/connected") |
||||||
|
include("*coverage.ec") |
||||||
|
into("$coverageInputDir/android_tests") // changing? change github workflow |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// Merge the two with a jacoco task. |
||||||
|
jacoco { toolVersion = "0.8.1" } |
||||||
|
tasks.register("computeCoverage", JacocoReport::class) { |
||||||
|
dependsOn("compileDebugSources") // Compile sources, needed below |
||||||
|
executionData.from(fileTree(coverageInputDir)) |
||||||
|
sourceDirectories.from(android.sourceSets["main"].java.sourceFiles) |
||||||
|
additionalSourceDirs.from("$buildDir/generated/source/buildConfig/debug") |
||||||
|
additionalSourceDirs.from("$buildDir/generated/source/r/debug") |
||||||
|
classDirectories.from(fileTree("$buildDir/intermediates/javac/debug") { |
||||||
|
// Not everything here is relevant for CameraView, but let's keep it generic |
||||||
|
exclude( |
||||||
|
"**/R.class", |
||||||
|
"**/R$*.class", |
||||||
|
"**/BuildConfig.*", |
||||||
|
"**/Manifest*.*", |
||||||
|
"android/**", |
||||||
|
"androidx/**", |
||||||
|
"com/google/**", |
||||||
|
"**/*\$ViewInjector*.*", |
||||||
|
"**/Dagger*Component.class", |
||||||
|
"**/Dagger*Component\$Builder.class", |
||||||
|
"**/*Module_*Factory.class", |
||||||
|
// We don"t test OpenGL filters. |
||||||
|
"**/com/otaliastudios/cameraview/filters/**.*" |
||||||
|
) |
||||||
|
}) |
||||||
|
reports.html.isEnabled = true |
||||||
|
reports.xml.isEnabled = true |
||||||
|
reports.html.destination = file("$coverageOutputDir/html") |
||||||
|
reports.xml.destination = file("$coverageOutputDir/xml/report.xml") |
||||||
|
} |
@ -1,27 +0,0 @@ |
|||||||
apply plugin: 'com.android.application' |
|
||||||
|
|
||||||
android { |
|
||||||
compileSdkVersion rootProject.ext.compileSdkVersion |
|
||||||
|
|
||||||
defaultConfig { |
|
||||||
applicationId "com.otaliastudios.cameraview.demo" |
|
||||||
minSdkVersion rootProject.ext.minSdkVersion |
|
||||||
targetSdkVersion rootProject.ext.targetSdkVersion |
|
||||||
versionCode 1 |
|
||||||
versionName "1.0" |
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
|
||||||
vectorDrawables.useSupportLibrary = true |
|
||||||
} |
|
||||||
buildTypes { |
|
||||||
release { |
|
||||||
minifyEnabled false |
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
dependencies { |
|
||||||
implementation project(':cameraview') |
|
||||||
implementation 'androidx.appcompat:appcompat:1.1.0' |
|
||||||
implementation 'com.google.android.material:material:1.1.0-beta01' |
|
||||||
} |
|
@ -0,0 +1,21 @@ |
|||||||
|
plugins { |
||||||
|
id("com.android.application") |
||||||
|
} |
||||||
|
|
||||||
|
android { |
||||||
|
setCompileSdkVersion(rootProject.property("compileSdkVersion") as Int) |
||||||
|
defaultConfig { |
||||||
|
applicationId = "com.otaliastudios.cameraview.demo" |
||||||
|
setMinSdkVersion(rootProject.property("minSdkVersion") as Int) |
||||||
|
setTargetSdkVersion(rootProject.property("targetSdkVersion") as Int) |
||||||
|
versionCode = 1 |
||||||
|
versionName = "1.0" |
||||||
|
vectorDrawables.useSupportLibrary = true |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
dependencies { |
||||||
|
implementation(project(":cameraview")) |
||||||
|
implementation("androidx.appcompat:appcompat:1.1.0") |
||||||
|
implementation("com.google.android.material:material:1.1.0") |
||||||
|
} |
@ -0,0 +1,95 @@ |
|||||||
|
--- |
||||||
|
layout: page |
||||||
|
title: "FAQs" |
||||||
|
description: "Frequently asked questions" |
||||||
|
order: 4 |
||||||
|
disqus: 1 |
||||||
|
--- |
||||||
|
|
||||||
|
### Usage |
||||||
|
|
||||||
|
##### Q: Why is front camera flipped horizontally when using takePicture() or takeVideo() ? |
||||||
|
|
||||||
|
A: It's actually not flipped - if you show your left hand, the person in the picture will show its left hand as well, |
||||||
|
so this is the accurate representation of reality. |
||||||
|
|
||||||
|
However, if you want to flip the result horizontally to match the preview, |
||||||
|
you can do so by using the [snapshot APIs](../docs/capturing-media), which will respect what is shown in the preview. |
||||||
|
|
||||||
|
##### Q: Can I use filters / overlays / cropping with takePicture() instead of takePictureSnapshot() ? |
||||||
|
|
||||||
|
A: No, these features are only available with the snapshot API. |
||||||
|
|
||||||
|
##### Q: Can I use filters / overlays / cropping with takeVideo() instead of takeVideoSnapshot() ? |
||||||
|
|
||||||
|
A: No, these features are only available with the snapshot API. |
||||||
|
|
||||||
|
##### Q: How can I improve takePictureSnapshot() quality? |
||||||
|
|
||||||
|
A: The picture quality can be controlled in two ways: |
||||||
|
- By [changing the snapshot size](../docs/snapshot-size) |
||||||
|
- By [enabling metering](../docs/metering#picture-metering). |
||||||
|
|
||||||
|
##### Q: How can I improve takeVideoSnapshot() quality? |
||||||
|
|
||||||
|
A: The video quality can be controlled as follows: |
||||||
|
- By changing the [snapshot size](../docs/snapshot-size) |
||||||
|
- By changing the [snapshot framerate](../docs/controls#cameraPreviewFrameRate) (carefully: high values can cause dark preview) |
||||||
|
- By changing the [video bitrate](../docs/controls#cameraVideoBitRate) |
||||||
|
- By changing the [audio bitrate](../docs/controls#cameraAudioBitRate) |
||||||
|
|
||||||
|
##### Q: How can I reduce the picture size? |
||||||
|
|
||||||
|
A: The only control here is the picture size. |
||||||
|
- When using `takePicture()`, change the [capture size](../docs/capture-size) |
||||||
|
- When using `takePictureSnapshot()`, change the [snapshot size](../docs/snapshot-size) |
||||||
|
|
||||||
|
##### Q: How can I reduce the video size? |
||||||
|
|
||||||
|
A: By using video controls, for instance: |
||||||
|
- Change the [video bitrate](../docs/controls#cameraVideoBitRate) |
||||||
|
- Change the [audio bitrate](../docs/controls#cameraAudioBitRate) |
||||||
|
- When using `takeVideo()`, change the [capture size](../docs/capture-size) |
||||||
|
- When using `takeVideoSnapshot()`, change the [snapshot size](../docs/snapshot-size) |
||||||
|
|
||||||
|
##### Q: Why is my preview / snapshot dark? |
||||||
|
|
||||||
|
A: This is often caused by bad [framerate](../docs/controls#cameraPreviewFrameRate). Try using |
||||||
|
a lower value, so that there's more time for frame exposure. |
||||||
|
|
||||||
|
### Project Management |
||||||
|
|
||||||
|
##### Q: I have found a bug with Camera1, can you fix it? |
||||||
|
|
||||||
|
A: No, we will not address Camera1 bugs anymore - development is focused on Camera2. However, if you find a solution, |
||||||
|
feel free to open a GitHub issue or pull requests to discuss. |
||||||
|
|
||||||
|
##### Q: I have found a bug with my device XYZ, can you fix it? |
||||||
|
|
||||||
|
A: No. Unless it's a device that we physically own, there is very little chance that a device-specific issues |
||||||
|
can be solved by the maintainers. We encourage you to investigate on your own and get back to us |
||||||
|
with a clear understanding of the problem and the solution. |
||||||
|
|
||||||
|
##### Q: Why don't you review / comment on my GitHub issue? |
||||||
|
|
||||||
|
A: Either because the issue did not respect the provided template, or because I don't have time. |
||||||
|
If you are sure about the template, you can get private support by [sponsoring the project](../extra/donate). |
||||||
|
|
||||||
|
##### Q: Why don't you review / comment on my GitHub pull requests? |
||||||
|
|
||||||
|
A: Either because the pull requests did not respect the provided template, or because I don't have time. |
||||||
|
If you are sure about the template, you can get private support by [sponsoring the project](../extra/donate). |
||||||
|
|
||||||
|
##### Q: When will you do a new release? |
||||||
|
|
||||||
|
A: We don't have a release schedule. New releases happen when there's enough changes to justify one, |
||||||
|
and maintainers have had time to execute and publish the release. You can speed things up by |
||||||
|
[sponsoring the project](../extra/donate) or pull snapshots from [jitpack.io](https://jitpack.io): |
||||||
|
|
||||||
|
```groovy |
||||||
|
implementation 'com.github.natario1:CameraView:master-SNAPSHOT' |
||||||
|
implementation 'com.github.natario1:CameraView:<commit hash>' |
||||||
|
``` |
||||||
|
|
||||||
|
Check their website for more information about how to set things up. |
||||||
|
|
@ -1 +0,0 @@ |
|||||||
include ':demo', ':cameraview' |
|
@ -0,0 +1,2 @@ |
|||||||
|
include(":cameraview") |
||||||
|
include(":demo") |
Loading…
Reference in new issue