我正在使用以下应用程序链接:https ://developer.android.com/training/app-links/verify-site-associations
使用cmd时:adb shell pm verify-app-links
show: Unknown command: verify-app-links
Run Code Online (Sandbox Code Playgroud)
我的adb版本是:
$ adb --version
Android Debug Bridge version 1.0.41
Version 31.0.3-7562133
Run Code Online (Sandbox Code Playgroud)
几乎是最新的,为什么未知命令:verify-app-links?
我正在尝试使用 jetpack 进行简单的测试,如下所示
@MediumTest
@RunWith(JUnit4::class)
class LoginScreenTest {
@get:Rule
val composeTestRule = createComposeRule()
@Test
fun test1() {
composeTestRule.setContent {
Text(text = "HEY")
}
composeTestRule.onNodeWithText("HEY").assertIsDisplayed()
}
}
Run Code Online (Sandbox Code Playgroud)
但是虽然成功了,但是在android studio中总是显示为canceled

只有logcat可以显示是否出现故障
I/TestRunner: run finished: 1 tests, 0 failed, 0 ignored
Run Code Online (Sandbox Code Playgroud)
那么知道如何解决这个问题吗?任何帮助将不胜感激
Compose version : 1.0.0-alpha11
Run Code Online (Sandbox Code Playgroud) testing android kotlin android-jetpack android-jetpack-compose
我一直有这个错误,但我已经做了他们要求我做的事情。
这是错误:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':audio_service'.
> Could not create an instance of type com.android.build.api.variant.impl.LibraryVariantBuilderImpl.
> Namespace not specified. Please specify a namespace in the module's build.gradle file like so:
android {
namespace 'com.example.namespace'
}
If the package attribute is specified in the source AndroidManifest.xml, it can be migrated automatically to the namespace value in the build.gradle file using the AGP Upgrade Assistant; please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for …Run Code Online (Sandbox Code Playgroud) 我对詹金斯很陌生。
Jenkins 中已经配置了多个作业,到目前为止,我们正在一个接一个地手动运行所有作业。我想通过管道插件使其成为一项单一的工作,从而减少手动工作。
我已经浏览了链接,它指出我们应该在我们的存储库中有 JenkinsFile 它基本上包含执行不同任务的命令。
但是如果我在 JenkinsFile 中配置它,如何给出现有的作业名称?
这是做管道的唯一方法还是有其他方法可以实现这一目标?
例如:我有三份工作
我想管道所有三个工作,
deploy-stage-ci
Run Code Online (Sandbox Code Playgroud)
以便它包含上述所有 3 个作业。
continuous-integration continuous-deployment jenkins-pipeline
我有改造接口
interface ApiInterface {
@GET
Observable<okhttp3.ResponseBody> get(@Url String url,
@HeaderMap Map<String, Object> headerMap,
@QueryMap HashMap<String, String> queryMap );
}
Run Code Online (Sandbox Code Playgroud)
我这样调用,它完美地工作
HashMap<String, String> map = new HashMap<String, String>();
map.put("id","xyz");
apiInterface.get(url, getHeader(),map)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
Run Code Online (Sandbox Code Playgroud)
但是当我通过时null,它不起作用
return apiInterface.get(url, getHeader(),null)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
Run Code Online (Sandbox Code Playgroud)
如何通过 null 来改造接口?
我需要在 MVVM 中获取用户身份验证状态。在存储库中我这样做:
override fun getAuthResponse() = callbackFlow {
val listener = AuthStateListener {
Log.d(TAG, "currentUser: " + (currentUser == null)) //Line2
trySend(it.currentUser == null)
}
auth.addAuthStateListener(listener)
awaitClose {
auth.removeAuthStateListener(listener)
}
}
Run Code Online (Sandbox Code Playgroud)
“Line2”将始终打印,true因为用户未经过身份验证。然后在 ViewModel 中我有:
fun getAuthResponse() = repo.getAuthResponse()
Run Code Online (Sandbox Code Playgroud)
以及内部活动:
setContent {
//...
val response = viewModel.getAuthResponse().collectAsState(initial = false).value
Log.d(TAG, "response: $response") //Line1
}
Run Code Online (Sandbox Code Playgroud)
由于 setContent 是一个可组合函数,因此当我打开应用程序时,它会触发两次。这意味着“Line1”处的日志语句被触发两次。当它第一次点火时,我得到:
response: false
currentUser: true
Run Code Online (Sandbox Code Playgroud)
因此,即使我在前一行调用了 getAuthResponse(),响应也会在之前打印。问题是,由于某种原因,即使当前用户为空,我也会在活动中打印出该用户不为空。当它第二次触发时,我得到了正确的数据:
response: true
currentUser: true
Run Code Online (Sandbox Code Playgroud)
为什么我得到一个非空的用户对象?trySend 会发出假数据吗?
kotlin firebase kotlin-coroutines android-jetpack-compose kotlin-flow
我有2个流量。第一个流每 50 毫秒更新一次。我有第二个流,它等于第一个流,但我希望它每 300 毫秒从原始流生成最新值。我找到了debounce流程扩展,但它不起作用(文档中的注释):
Note that the resulting flow does not emit anything as long as the original flow emits items faster than every timeoutMillis milliseconds.
因此,当我尝试每 300 毫秒发出一次带有去抖动的值时,它根本不会发出,因为原始流比我需要的要快。那么我怎样才能做这样的事情:
我现在的流程:
// fast flow (50ms)
val orientationFlow = merge(_orientationFlow, locationFlow)
val cameraBearingFlow = orientationFlow.debounce(300ms)
Run Code Online (Sandbox Code Playgroud)
PS 这种方法不适合,因为我们延迟了值,所以 300 毫秒后它就不再新鲜了。我需要在 300 毫秒后获取最新值:
val cameraBearingFlow = azimuthFlow.onEach {
delay(ORIENTATION_UPDATE_DELAY)
it
}
Run Code Online (Sandbox Code Playgroud) 我尝试了很多片段。这就是我现在正在使用的。我知道 MediaStore.Video.Media.DATA 已弃用。不知何故此方法也适用于 android 10,但有时会抛出
android.database.CursorIndexOutOfBoundsException: 请求索引 0,大小为 0
public static String getvideoPath(Context context, Uri uri) {
try {
Cursor cursor = context.getContentResolver().query(uri, null, null, null, null);
cursor.moveToFirst();
String document_id = cursor.getString(0);
LogMessage.v("Document Id:: "+document_id);
if(document_id!=null){
document_id = document_id.substring(document_id.lastIndexOf(":") + 1);
cursor.close();
cursor = context.getContentResolver().query(
MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
null, MediaStore.Video.Media._ID + " = ? ", new String[]{document_id}, null);
cursor.moveToFirst();
String path = cursor.getString(cursor.getColumnIndex(MediaStore.Video.Media.DATA));
cursor.close();
return path;
}else
return getPath(context,uri);
} catch (Exception e) {
e.printStackTrace();
return getPath(context,uri);
}
}
private static String …Run Code Online (Sandbox Code Playgroud) 我以前开发过一个应用程序,现在我找不到我的应用程序源代码。
我想对我的应用程序进行一些更改。
现在我只有我的密钥库(jks 文件),我之前用它来签署我的应用程序。
我使用在线 Apk Decompiler来反编译我的应用程序,但它没有给出我想要的结果。我需要它来编辑我的代码并将其提供给客户,但它为我提供了如下所示的代码预览,其中包含难以理解的类和方法名称。
我反编译的APK文件夹目录
我的代码预览
我知道这个问题是为了在 gradle 中将发布模式的 minify enabled设置为 true 。
有什么方法可以将反编译的代码恢复为可理解的代码,或者使用密钥库将其恢复或使用可理解的源代码反编译应用程序 apk 文件?
我真的需要反编译这个 apk 并对其进行一些更改。特别是应用程序源文件。
任何帮助将不胜感激 :)
fastAny()我正在使用以下示例代码尝试 Kotlin 的 List Util函数:
fun main() {
val list = mutableListOf(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
val predicate = list.fastAny { it > 3 }
}
Run Code Online (Sandbox Code Playgroud)
函数正在Android project解析,但尚未解析IntelliJ project.

我可能会错过什么?