Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.Deepblue1996:Camera2View:0.2.0'
}
dependencies {
implementation("com.github.Deepblue1996:Camera2View:0.2.0")
}
<dependency>
<groupId>com.github.Deepblue1996</groupId>
<artifactId>Camera2View</artifactId>
<version>0.2.0</version>
</dependency>
libraryDependencies += "com.github.Deepblue1996" % "Camera2View" % "0.2.0"
:dependencies [[com.github.Deepblue1996/Camera2View "0.2.0"]]
<zou.dahua.cameralib.CameraView
android:id="@+id/cameraView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
照相机画布显示
cameraView.show(this);
1.在AndroidManifest.xml申明所需要的权限:
(注:请确保进入Camera2的时候已经拥有这三项权限了,Android6.0需要动态去申请权限)
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
How to
To get a Git project into your build:
Step 1. Add the JitPack repository to your build file
gradle maven sbt leiningen Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.Deepblue1996:Camera2View:0.2.0'
}