小编spa*_*lug的帖子

Android Studio - 错误:程序类型已存在

当我尝试编译代码时,Android Studio 3.0.1上会出现以下错误

Error:Program type already present: com.squareup.picasso.Action$RequestWeakReference
Run Code Online (Sandbox Code Playgroud)

我的gradle代码:

  ...
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support:design:26.1.0'
    compile 'com.android.support:support-v4:26.1.0'
    compile 'com.android.support:support-vector-drawable:26.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.1.0-beta4'
    compile 'com.google.firebase:firebase-messaging:11.8.0'
    compile 'com.google.firebase:firebase-ads:11.8.0'
    compile 'com.google.gms:google-services:3.1.0'
    compile 'com.google.android.gms:play-services:11.8.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    testCompile 'junit:junit:4.12'

}

apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

如何修复我的gradle脚本以修复错误?

android build gradle android-studio build.gradle

26
推荐指数
3
解决办法
4万
查看次数

从imageview触摸点,您可以调整MAT的大小以获得该点颜色吗?

在横向,我使用myImageView.setImageBitmap(myBitmap)和使用ontouch侦听器,以getXgetY和调整的位置myImageView(同getRawXgetRawY).然后bitmapToMat,我使用构建MAT来使用OpenCV更多地处理图像.我找到了两个调整大小的场景,其中onTouch位置将在我触摸的位置绘制一个圆圈,但有时位置将位于Mat之外并导致NPE并在处理期间失败.

场景1: resize(myImageView.getWidth(), myImageView.getHeight())

场景2:resize(myImageView.getHeight(), myImageView.getWidth())

x = x(myImage.getHeight()/myImageView.getWidth())

y = y(myImage.getWidth()/myImageView.getHeight())
Run Code Online (Sandbox Code Playgroud)

如果我不改变x,我可以点击NPE图像中的任何地方,但画出的圆圈远不在我触摸的地方.

处理后我matToBitmap(myMAT, newBitmap)myImageView.setImageBitmap(newBitmap).

我显然错过了一些东西,但有没有一个简单的方法来获得触摸位置并在MAT中使用该位置?任何帮助都是极好的!

java android opencv touch-event

6
推荐指数
1
解决办法
173
查看次数