以下代码适用于除最新4.2之外的所有Android版本
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import javax.crypto.BadPaddingException;
import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.KeyGenerator;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
/**
* Util class to perform encryption/decryption over strings. <br/>
*/
public final class UtilsEncryption
{
/** The logging TAG */
private static final String TAG = UtilsEncryption.class.getName();
/** */
private static final String KEY = "some_encryption_key";
/**
* Avoid instantiation. <br/>
*/
private UtilsEncryption()
{
}
/** The HEX characters */
private final static String HEX = "0123456789ABCDEF"; …Run Code Online (Sandbox Code Playgroud) 如何在GoogleMap V2中自定义内置缩放控件的位置?
对于Google地图库的第1版,有很多与此主题相关的问题.
如何使用setBuiltInZoomControls(true)布局缩放控件?
但是,我无法找到与库的V2有关的任何问题.
在V2中,没有方法
(LinearLayout) mapView.getZoomControls();
Run Code Online (Sandbox Code Playgroud)
所有前面提到的问题都已过时.
提前致谢
我在我的应用程序中使用自定义图标作为用户的当前位置,并希望在升级到新的Google地图库时保持这种方式.
使用Google Maps v1库,我扩展了MyLocationOverlay并覆盖了drawMyLocation方法以在那里绘制我的自定义图标.
谷歌地图使用setMyLocationEnabled方法启用当前位置,但据我所知,没有办法自定义它.
有谁知道如何在v2上实现这一目标?
有没有人知道任何具有3D功能的免费android地图库?我确定谷歌地图在使用sdk库时不支持3d.
提供商不是问题.我没有与谷歌地图结婚,也没有任何其他.
以下是可以用作我正在尝试完成的示例的应用程序.
Waze https://play.google.com/store/apps/details?id=com.waze
66号公路 https://play.google.com/store/apps/details?id=com.route66.maps5
例

我正在尝试在Docker中编译一个多模块的android应用程序(它是一个CI构建).其中一些模块包含Kotlin源代码.
构建在本地环境(MacOS)上运行良好,但由于某种原因,CI失败.
当地环境
MacOS 10.125.
java版"1.8.0_121"(Java(TM)SE运行时环境(版本1.8.0_121-b13)
CI环境
应用配置
Gradle Wrapper 4.0.-rc1
Android Build工具26
Kotlin版本'1.1.2-2'
gradle.properties(虽然我玩过所有组合并且都没有工作)
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx2048M
org.gradle.configureondemand=true
kotlin.compiler.execution.strategy=in-process
看起来它与某些远程进程有关,因为它无法连接到它.我想过Kotlin和Gradle deamon但是在玩了很多不同的gradle.properties配置之后,我似乎无法获得有效的配置.
warning: [options] bootstrap class path not set in conjunction with -source 1.7
Using kotlin incremental compilation
Using kotlin incremental compilation
1 warning
Compilation with Kotlin compile daemon was not successful
java.lang.IllegalStateException: Service is dying
at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Dying.get(CompileService.kt:55)
at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Dying.get(CompileService.kt:54)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.compileWithDaemon(GradleKotlinCompilerRunner.kt:150)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.compileWithDaemonOrFallback(GradleKotlinCompilerRunner.kt:112)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.compileWithDaemonOrFallback(GradleKotlinCompilerRunner.kt:49)
at org.jetbrains.kotlin.compilerRunner.KotlinCompilerRunner.runCompiler(KotlinCompilerRunner.kt:134)
at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.runJvmCompiler(GradleKotlinCompilerRunner.kt:73)
at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler$kotlin_gradle_plugin(Tasks.kt:259)
at org.jetbrains.kotlin.gradle.tasks.KotlinCompile.callCompiler$kotlin_gradle_plugin(Tasks.kt:160)
at org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile.execute(Tasks.kt:141)
at …Run Code Online (Sandbox Code Playgroud) 我个人喜欢when语法,因为它会使识别更加清晰.但是我担心这样做可能会引入"惩罚".
我不是字节码的专家,但我可以看到,对于相同的'逻辑',when子句需要更多的字节码操作.
具有3种不同Kotlin功能的简单文件
package com.whatever
fun method1(): String {
return if (BuildConfig.DEBUG) "something" else "else"
}
fun method2(): String {
return if (BuildConfig.DEBUG) {
"something"
} else {
"else"
}
}
fun method3(): String {
return when (BuildConfig.DEBUG) {
true -> "something"
else -> "else"
}
}
Run Code Online (Sandbox Code Playgroud)
生成的字节码
// access flags 0x19
public final static method1()Ljava/lang/String;
@Lorg/jetbrains/annotations/NotNull;() // invisible
L0
LINENUMBER 4 L0
GETSTATIC com/whatever/BuildConfig.DEBUG : Z
IFEQ L1
LDC "something"
GOTO L2
L1
LDC "else"
L2
ARETURN …Run Code Online (Sandbox Code Playgroud) 在向android库添加firebase依赖项时,我遇到了构建问题.
我的设置如下
/settings.gradle
include ':module-lib'
include ':module-app'
Run Code Online (Sandbox Code Playgroud)
/build.gradle
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.0.0'
}
}
Run Code Online (Sandbox Code Playgroud)
/module-lib/build.gradle
apply plugin: 'com.android.library'
android {
...
}
dependencies{
api "com.google.firebase:firebase-config:16.0.0"
}
Run Code Online (Sandbox Code Playgroud)
/module-app/build.gradle
apply plugin: 'com.android.application'
android {
...
}
dependencies {
implementation project(':module-lib')
}
apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)
短日志:
$ ./gradlew clean build
Starting a Gradle Daemon, 1 busy and 2 stopped Daemons could not be reused, use --status for details
Parallel execution is an incubating feature.
> Configure project :module-app
Detected …Run Code Online (Sandbox Code Playgroud) 我是颤振开发的新手,并试图了解 Riverpod。
我目前设法使以下登录表单与 StatefulWidget 一起使用。基本上,如果两个字段都不为空,则该按钮将被启用,反之亦然。
这是它的当前代码。
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Login Demo',
// theme: ThemeData(
// primarySwatch: Colors.blue,
// ),
home: Scaffold(
body: Center(
child: SizedBox(
width: 400,
child: MyLoginPage2(),
),
),
),
);
}
}
class MyLoginPage extends StatefulWidget {
const MyLoginPage({Key? key}) : super(key: key); …Run Code Online (Sandbox Code Playgroud) 我有一个应用程序,可以获得位置修复.该应用程序将从Gingerbread推出到手机上.一旦应用程序获得位置修复,就会向用户显示Toast消息.问题是当用户移动到下一个活动时,吐司消息可能会再出现十次.
我想我已经正确地实现了生命周期,例如
1)在onCreate()中获取位置管理器2)在onResume()中创建并将位置监听器传递给管理器3)删除onStop()中的更新
我知道我可以通过调用在Android> 4.x中绕过这个问题
mlocManager.requestSingleUpdate(LocationManager.GPS_PROVIDER, mlocListener, null);
Run Code Online (Sandbox Code Playgroud)
但是我必须容纳Gingerbread所以调用单个请求不在api 2.3.x. 它在Android 4上工作正常但在姜饼上onLocationChanged方法继续执行10次.
我如何强制onLocationChanged方法只在姜饼上运行一次?
谢谢.
[编辑]我注意到,当我移动到下一个活动时,onlocationchanged方法继续执行,但如果我移动到另一个活动,则成功删除位置请求
@Override
protected void onStop() {
mlocManager.removeUpdates(mlocListener);
mlocListener = null;
super.onStop();
}
@Override
protected void onResume() {
mlocListener = new MyLocationListener();
if(isCompOptionsReceived == true){
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.GINGERBREAD_MR1) {
mlocManager.requestSingleUpdate(LocationManager.GPS_PROVIDER, mlocListener, null);
}else{
mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, mlocListener);
}
}
super.onResume();
}
private class MyLocationListener implements LocationListener {
@Override
public void onLocationChanged(Location loc) {
//toast message
}
@Override
public void onProviderDisabled(String provider) {
}
@Override
public void …Run Code Online (Sandbox Code Playgroud) 我在Genymotion上创建了一个新的虚拟设备但我无法运行它.当我点击Genymotion GUI上的"开始"按钮时,没有任何反应.

我能够从Virtual Box运行虚拟设备.虚拟设备显然配置良好,互联网正常运行.

我目前的环境:
值得一提的是,我最近格式化了计算机并从头开始安装了所有东西(甚至Yosemite),所以我可以错过依赖或其他东西.
任何有关如何修复它或获取日志以了解真正问题的帮助或提示将不胜感激.
谢谢
android ×8
google-maps ×2
gradle ×2
kotlin ×2
3d ×1
bytecode ×1
docker ×1
encryption ×1
firebase ×1
flutter ×1
flutter-web ×1
genymotion ×1
gps ×1
hook-widgets ×1
location ×1
maps ×1
riverpod ×1
unit-testing ×1
virtualbox ×1