android

AS中加载gradle时出现Gradle sync failed: Could not find com.android.tools.build:gradle.的错误

可紊 提交于 2021-02-16 18:00:35
时间:2019/12/7 这次接着整理加载gradle时出现的错误 出现的错误: 1 Gradle sync failed: Could not find com.android.tools.build:gradle:3.5.0 . 2 Searched in the following locations: 3 file:/F:/studio/studio2.0/gradle/m2repository/com/android/tools/build/gradle/2.8/gradle-2.8 .pom 4 file:/F:/studio/studio2.0/gradle/m2repository/com/android/tools/build/gradle/2.8/gradle-2.8 .jar 5 https: // jcenter.bintray.com/com/android/tools/build/gradle/2.8/gradle-2.8.pom 6 https: // jcenter.bintray.com/com/android/tools/build/gradle/2.8/gradle-2.8.jar 7 Required by: 8 :TestApk:unspecified 9 Consult IDE log for more details (Help |

Notification action icon didn't show

独自空忆成欢 提交于 2021-02-16 17:51:52
问题 I try to show a notification in Android, and use the code from this Link. In some source people said that the icon should be totally white and some source said I should use .png instead of vector . I try all of this ways but no one didn't help me. I try this code: Notification newMessageNotification = new Notification.Builder(mContext) .setSmallIcon(R.drawable.ic_message) .setContentTitle(getString(R.string.title)) .setContentText(getString(R.string.content)) .addAction(action)) .build(); 回答1

使用fiddler实现手机抓包

梦想的初衷 提交于 2021-02-16 17:44:23
手机上无法直接查看网络请求数据,需要使用抓包工具。Fiddler是一个免费的web调试代理,可以用它实现记录、查看和调试手机终端和远程服务器之间的http/https通信。 fiddler没有手机客户端,都是安装在PC上,要实现对手机上的程序抓包,则需要对PC上的fiddler和手机端做一些配置。步骤如下: 一、PC端fiddler配置 1. 安装HTTPS证书 手机上的应用很多涉及到个人信息,采用比较安全的HTTPS加密过,而fiddler默认只捕获http会话而不抓取HTTPS报文,导致打开fiddler后就打不开https网页(比如百度),解决办法: 打开Fiddler->Tool->Fiddler Options->HTTPS tab,勾选上并Capture HTTPS CONNECTs(捕获 HTTPS 连接)和 Decrypt HTTPS traffic (HTTPS 请求解密),并安装证书(首次使用无证书,会弹出是否信任fiddler证书和安全提示,直接点击yes就行),重启Fiddler生效。 fiddler HTTPS配置 2. 允许手机远程连接 如果想要捕获手机上的通信数据,就需要手机连接上Fiddler代理,而Fiddler默认是不允许其他设备进行连接的,解决办法: 点击 Fiddler->Tools -> Options,在 Connections 面板选中

android 画竖虚线

百般思念 提交于 2021-02-16 17:20:37
参考:http://blog.csdn.net/zhao2017/article/details/73866460 1.在Android中写横虚线比较简单,写竖虚线的话稍微麻烦点: 需要将写的虚线旋转: 这里面旋转角度设置为90 到90。 < rotate xmlns:android= "http://schemas.android.com/apk/res/android" android:fromDegrees= "90" android:toDegrees= "90"> < shape android:shape= "line"> < stroke android:width= "1dp" android:color= "#ebebeb" android:dashGap= "1dp" android:dashWidth= "2dp" /> < size android:width= "200dp" android:height= "3dp"> </ size> </ shape> </ rotate> 然后在用的地方可以将View的宽度设置的很大,以免周边的View影响其显示。 竖虚线在实际中用到的地方。 < View android:id= "@+id/view" android:layout_width= "100dp" android:layerType=

android 竖向滑动刻度

為{幸葍}努か 提交于 2021-02-16 16:51:03
VerticalScaleView介绍 竖向刻度:尺实现竖着的滑动刻度,支持自定义初始值、最大值、最小值,支持惯性滑动…… github https://github.com/supertaohaili/VerticalScaleView 效果图 使用 verticalRullView.setMin(0); //设置刻度尺最小值 verticalRullView.setMax(255); //设置刻度尺最大值 verticalRullView.setInterval(10); //设置刻度尺的间距 verticalRullView.setTextOffset(20); //根据显示的数字自主调节刻度尺数字的左右位置 verticalRullView.setRuleListener(new VerticalScaleView.ScaleCallback() { @Override public void onScaleSelected(int length, int value) { //获得即时显示的数字 tVertical.setText(String.valueOf(value)); } }); Known Issues If you have any questions/queries/Bugs/Hugs please mail @ taohailili@gmail.com

How To change Android App Bundles name (app.aab) to reflect App version and build type

眉间皱痕 提交于 2021-02-16 16:43:28
问题 While I'm building an APK I can change APK name in build.gradle script, like that: android.applicationVariants.all { variant -> if (variant.buildType.name != "debug") { variant.outputs.all { outputFileName = "${variant.applicationId}-v${variant.versionName}-${variant.name}.apk" } } } An I'll have something like this com.myapp.package-v1.x.x-release Is there a way to do something similar with Android App Bundles, it is not convenient to always have app.aab 回答1: I have come up with the solution

Is there a way to control the order of child entity, when using one-to-many relationhips?

北慕城南 提交于 2021-02-16 16:27:09
问题 According to https://developer.android.com/training/data-storage/room/relationships We can have one-to-many relationships public class UserWithPlaylists { @Embedded public User user; @Relation( parentColumn = "userId", entityColumn = "userCreatorId" ) public List<Playlist> playlists; } @Transaction @Query("SELECT * FROM User") public List<UserWithPlaylists> getUsersWithPlaylists(); In both entity User and Playlist , we have added a column named sort_key The purpose is, when we perform query,

Android make oval background drawable with chat corner

蹲街弑〆低调 提交于 2021-02-16 16:25:07
问题 I know how to create oval background, I add this drawable to a RelativeLayout background: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> <solid android:color="#FFFFFF"/> <corners android:bottomRightRadius="15dp" android:bottomLeftRadius="15dp" android:topLeftRadius="15dp" android:topRightRadius="15dp"/> </shape> But I want to create this drawable and the corner of a chat like this: How can I add to this drawable the corner

Android make oval background drawable with chat corner

断了今生、忘了曾经 提交于 2021-02-16 16:24:34
问题 I know how to create oval background, I add this drawable to a RelativeLayout background: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> <solid android:color="#FFFFFF"/> <corners android:bottomRightRadius="15dp" android:bottomLeftRadius="15dp" android:topLeftRadius="15dp" android:topRightRadius="15dp"/> </shape> But I want to create this drawable and the corner of a chat like this: How can I add to this drawable the corner

Kotlin: how to return running service instance in binder?

a 夏天 提交于 2021-02-16 16:10:57
问题 I have working Java code for Service and trying to convert it to Kotlin . class MyService : Service() { companion object MyBinder : Binder() { fun getService() : MyService? { return MyService::class.objectInstance } } // service implementation } The problem is that in activities getService() always returns null. I am sure the service is started before, I see it in logcat. I suggest this auto generated line from Java code should be different but I cannot find the solution: return MyService: