二维码识别及生成

jar包地址:http://repo1.maven.org/maven2/com/google/zxing/

首先谈下遇到的问题:

1.提示 You should manually set the same version via DependencyResolution

Android dependency 'com.android.support:support-compat' has different version for the compile (25.3.0) and runtime (28.0.0) classpath. You should manually set the same version via DependencyResolution

1、分析原因:引用了不同版本的v4包造成的

2、解决方案:在当前project :app的build.gradle用下面这个方法

configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.0'
            }
        }
    }
}

2 AndroidManifest.xml:5:5-19:19 to override.

Manifest merger failed : Attribute application@icon value=(@mipmap/ic_launcher) from AndroidManifest.xml:7:9-43

is also present at [:qrlibs-debug:] AndroidManifest.xml:52:9-47 value=(@drawable/launcher_icon).
Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.

解决方法

注意两个地方:

1. 在manifest节点加上:xmlns:tools="http://schemas.android.com/tools"

2. 在application 节点加上:tools:replace="android:icon, android:theme"

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.panzq.myqrcode">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        tools:replace="android:icon, android:theme"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".activity.GenerateQRActivity" />
        <activity android:name=".activity.ScanQRActivity"></activity>
    </application>

</manifest>

3、提示 'compile' is obsolete and has been replaced with 'implementation' and 'api'.

Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

 

implementation project(path: ':qrlibs')

4、参看编译出现的具体代码问题

androidstudio中查看编译报错信息,在Terminal中输入下面命令:

gradlew compileDebugSources --stacktrace -info

猜你喜欢

转载自www.cnblogs.com/qiangge-python/p/10559536.html
今日推荐