小编pra*_*ala的帖子

活动<应用程序名称>已泄露最初绑定在此处的ServiceConnection <ServiceConnection名称> @ 438030a8

我正在开发我的第一款Android应用.我的应用程序中有三个活动,用户来回切换频繁.我还有一个远程服务,它处理一个telnet连接.应用程序需要绑定到此服务才能发送/接收telnet消息.

编辑 感谢BDLS提供的信息.我已根据您对使用bindService()作为独立函数或在startService()之间的区别的说明重新编写了我的代码,现在我只是在使用后退按钮之间循环时间歇性地获取泄漏错误消息活动.

我的连接活动有以下onCreate()和onDestroy():

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    /*
     * Initialize the ServiceConnection.  Note that this is the only place startService() is run.
     * It is also the only time bindService is run without dependency on connectStatus.
     */
    conn = new TelnetServiceConnection();
    //start the service which handles telnet
    Intent i = new Intent();
    i.setClassName( "com.wingedvictorydesign.LightfactoryRemote", "com.wingedvictorydesign.LightfactoryRemote.TelnetService" );
    startService(i);
    //bind to the service
    bindService(i, conn, 0);

    setContentView(R.layout.connect);
    setupConnectUI();

}//end …
Run Code Online (Sandbox Code Playgroud)

android serviceconnection

124
推荐指数
5
解决办法
12万
查看次数

com.android.builder.testing.api.DeviceException:com.android.ddmlib.InstallException:无法安装所有

我正在使用React Native 0.26并尝试使用Google Plus登录以下npm for Android应用程序.

npm install react-native-google-signin --save

我正在使用命令行(react-native run-android)直接在我的设备上构建调试apks.

非常仔细地遵循所有安装步骤.默认情况下,我的构建仅适用于build.gradle(/ android /)上的Build工具版本1.2.3,并且它曾用于其他项目,但我在此项目中遇到以下错误,因为我必须包含以下行在build.gradle文件中,

classpath'com.google.gms:google-services:2.1.0'// <---添加此内容

当我添加它时,我还必须在android/gradle/wrapper/gradle-wrapper.properties上将distributionUrl修改为https://services.gradle.org/distributions/gradle-2.13-all.zip

在我尝试运行构建命令后进行所有修改后,它从不在设备上安装更新的apk,并且它停留在99%的进度.

以下是详细错误,

在'Micromax Q372 - 5.0'上为app安装APK'app-debug.apk':调试08:26:35 E/1526411097:上传app-debug.apk时出错:未知失败([CDS]关闭[0])无法使用安装/home/sid/react/gplus/android/app/build/outputs/apk/app-debug.apk com.android.ddmlib.InstallException:无法在com.android.ddmlib.SplitApkInstaller.install上安装所有内容(SplitApkInstaller)的.java:91)

......

:app:installDebug FAILED

FAILURE:构建因异常而失败.

出了什么问题:任务':app:installDebug'执行失败.

com.android.builder.testing.api.DeviceException:com.android.ddmlib.InstallException:无法安装所有Try:Run with --stacktrace选项以获取堆栈跟踪.使用--info或--debug选项运行以获取更多日志输出.

建筑失败

android gradle apk ubuntu-14.04 react-native

19
推荐指数
1
解决办法
5055
查看次数

由于工具栏,RecycleView在底部留有空白空间

更新:

  • 实际的问题是CoordinatorLayout没有RecycleView
  • 而不是使用RecycleView我尝试TextView内部ScrollView,这是相同的问题。
  • 如果你有什么不对齐ToolbarActionBar,并使用CoordinatorLayout与其他ToolBar如粘头与底部滚动元素

原版的:

我正在开发一个视图,该视图需要Sticky标头实现和底部的回收视图。我已经使用了协调器布局支持,如此处所述。

工作原理:

  • 滚动列表上的粘滞视图。
    • 使用layout_collapseMode = pinCollapsingToolbarLayout使用layout_scrollFlags = scroll|exitUntilCollapsed|snap属性的工具栏。
    • 与行为回收视图app:layout_behavior="@string/appbar_scrolling_view_behavior

问题是什么:

  • 回收视图,将边距留在底部,其大小与Toolbar我用于粘性视图的大小相同。
  • 回收视图的最后一项没有显示,它需要额外bottom_margin的粘性工具栏视图的大小。

观察:

  • 如果我填满回收站,那它就起作用了。但是如果延迟通知它会导致问题。
  • 更新。在另一次试运行中,我没有使用Recycle,而是TextViewNestedScrollView。(PFA)放在了其中(此处布局未更新)。
    • 在这里,我添加了来自xml的文本,并在延迟2秒后仅添加了一些文本,结果是相同的。
    • 它的布局再次占用了底部边距。因此,与Recycle视图无关的东西似乎与都存在问题CoordinatorLayout

我已经尝试过在这里这里)提供多种解决方案,但是没有任何效果。

PFA,电流输出。

在此处输入图片说明

更新 PFA,尝试延迟文本视图。

在此处输入图片说明

这是布局文件。

<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/summaryAppBar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"> …
Run Code Online (Sandbox Code Playgroud)

android android-toolbar android-coordinatorlayout android-collapsingtoolbarlayout stickyrecycleview

10
推荐指数
2
解决办法
1000
查看次数

检测到不一致。无效的项目位置 0(offset:-1)... RecyclerView 崩溃,删除第一项

我正在尝试删除我的RecyclerView. 使用 livedata 和 diffutil 监视对列表的更改。只有RecyclerView删除第一个项目(第 0 个索引)时才会发生崩溃。这可能看起来与其他相关问题相似。快速滚动等时不会出现此问题。仅在删除第 0 个位置的项目时才会出现。项目本身从数据库中删除。但应用程序崩溃。我尝试从RecyclerView课程中追溯错误:.tryGetViewHolderForPositionByDeadline(RecyclerView.java:5923)

从 RecyclerView.java:

if (offsetPosition < 0 || offsetPosition >= mAdapter.getItemCount()) {
            throw new IndexOutOfBoundsException("Inconsistency detected. Invalid item "
                    + "position " + position + "(offset:" + offsetPosition + ")."
                    + "state:" + mState.getItemCount());
        }
Run Code Online (Sandbox Code Playgroud)

偏移位置小于 0 (-1)

完整的错误堆栈:

03-23 08:55:38.739 25087-25087/com.application.essentials E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.application.essentials, PID: 25087
java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 0(offset:-1).state:3 android.support.v7.widget.RecyclerView{41df14f0 VFED.V.. ......ID …
Run Code Online (Sandbox Code Playgroud)

java android android-recyclerview

7
推荐指数
1
解决办法
5918
查看次数

无法获取提供者androidx.lifecycle.ProcessLifecycleOwnerInitializr

在运行具有依赖关系的应用程序'androidx.lifecycle:lifecycle-extensions:2.1.0-alpha03''androidx.lifecycle:lifecycle-viewmodel:2.1.0-alpha03'在具有Android 4.4的设备上运行时出错。

在Android 6上的设备上正常工作

应用因错误而崩溃

java.lang.RuntimeException: Unable to get provider androidx.lifecycle.ProcessLifecycleOwnerInitializer: java.lang.ClassNotFoundException: Didn't find class "androidx.lifecycle.ProcessLifecycleOwnerInitializer" on path: DexPathList[[zip file "/data/app/**********.apk"],nativeLibraryDirectories=[/data/app-lib/***********, /vendor/lib, /system/lib]]
    at android.app.ActivityThread.installProvider(ActivityThread.java:5052)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:4623)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4563)
    at android.app.ActivityThread.access$1500(ActivityThread.java:151)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402)
    at android.os.Handler.dispatchMessage(Handler.java:110)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:5333)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
    at dalvik.system.NativeStart.main(Native Method)
 Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.lifecycle.ProcessLifecycleOwnerInitializer" on path: DexPathList[[zip file "/data/app/**********.apk"],nativeLibraryDirectories=[/data/app-lib/********, /vendor/lib, /system/lib]]
Run Code Online (Sandbox Code Playgroud)

android viewmodel android-mvvm androidx

5
推荐指数
2
解决办法
1386
查看次数

改造 2.0:预期为 BEGIN_OBJECT,但在第 1 行第 1 列路径 $ 处为 STRING

我在邮递员上传递了更新用户请求并得到了成功的响应(见图),现在当我尝试在我的应用程序中使用 Retrofit 2 执行相同操作时,我收到错误为com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $. 有趣的是,我之前遇到过这个错误,我知道如果我的模型不符合响应,通常会发生这种情况。但这次我想我已经检查了所有的框,但还是出现了错误。如果有人能弄清楚我哪里出错了......

我在邮递员中的回应:

在此处输入图片说明

我的pojo:

package com.example.evidya.Retrofit.Model.EditModel;

import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class EditResponse {
    @SerializedName("result")
    @Expose
    private String result;

    @SerializedName("response_code")
    @Expose
    private Integer responseCode;

    @SerializedName("msg")
    @Expose
    private String msg;

    @SerializedName("data")
    @Expose
    private List<Object> data = null;

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public Integer getResponseCode() {
        return responseCode;
    }

    public …
Run Code Online (Sandbox Code Playgroud)

java android json retrofit retrofit2

5
推荐指数
1
解决办法
8069
查看次数

“选择证书”对话框未显示在 android webview 中

如果我尝试通过可以访问 Android 设备上的证书的 Chrome/Microsoft Edge 浏览器登录 web-url,则一切正常。

chrome/edge 浏览器工作的屏幕截图:

在 Chrome/Microsoft Edge 浏览器中选择证书对话框

我尝试使用 Android 网络视图登录到 android 应用程序上的 web-url,但“选择证书”对话框未显示在 android 网络视图中。

我还遇到过onReceivedClientCertRequest在 API 级别 21 中添加的方法,但我的应用程序需要支持回到 API 级别 17。

  1. onReceivedClientCertRequest方法是否会自动处理“选择证书”对话框?

我对这些证书和“选择证书”对话框有一些常见的疑问。

  1. 如何使用所有 Android API 级别 >= 17 的 web 视图在 android 移动应用程序中实现此类客户端身份验证流程。
  2. 用于此类身份验证的 Android 设备上的可用证书类型是什么。
  3. 如何在 Android 移动应用程序中实现此类身份验证流程,而不使用所有 Android API 级别 >= 17 的 webview。

authentication android ssl-certificate webview webviewclient

5
推荐指数
0
解决办法
194
查看次数

通过专门针对正在使用的 rootbeer 库绕过 Android App Root 检测方法

我的 Android 应用程序使用rootbear库来检测有根设备。但是在应用安全渗透测试过程中,使用“ unrootbeer Xposed 模块脚本绕过了rootbear root 检测机制

以下是渗透测试过程中遵循的步骤:

第1步 。在有 root 权限的 android 设备中运行应用程序以查看错误,因为它检测到有 root 权限的设备。

步骤 2. 运行 Jadx 并检查是否存在根检测机制。正如我们所见,正在使用 rootbeer 方法。

步骤 3.通过在设备中安装和激活运行 unrootbeer Xposed 模块脚本

步骤 4. 现在重启设备并等待激活。

步骤 5. 打开应用程序,绕过应用程序根检测机制

我还检查了其他库RootTools。是RootTools库的合适的和最新的库,用于根检测?

这些是一些问题:

  1. 如何防止rootbear库root检测绕过

  2. 混淆是否有助于防止这种绕过?

  3. 是否有任何其他可用的无法绕过的根检测库

  4. 谷歌有没有更好的根检测实现?

android rooted-device roottools xposed-framework mobile-security

5
推荐指数
0
解决办法
560
查看次数

Selenium Webdriver 3.141.0 driver.Manage().Logs.AvailableLogTypes 抛出 System.NullReference 异常

在我最新的 Chrome 更新到 76 版本后,我用来获取任何控制台日志的 Selenium 代码片段driver.Manage().Logs.GetLog(LogType.Browser)抛出错误。注意Logs.AvaialbleLogTypes正在抛出NullReference exception。我们需要启用任何设置吗?有没有其他方法可以获得控制台错误

我尝试使用LoggingPreferences但返回无效参数错误并且无法打开 chrome 驱动程序

c# selenium google-chrome selenium-webdriver

4
推荐指数
1
解决办法
2211
查看次数

Android 更新后的改造崩溃

几天前将我的 Android Studio 更新到最新版本后,我在改造和 okhttp 方面遇到了问题。在此之前,我的代码可以正常工作,没有任何问题。这是改造客户端的类,它崩溃了

public class ApiClient {
public static final String BASE_URL = "myapiurl";
private static Retrofit mRetrofit = null;

public static Retrofit getClient() {
    if (mRetrofit ==null) {
        Gson gson = new GsonBuilder()
                .setLenient()
                .setDateFormat("yyyy-MM-dd'T'HH:mm:ss")
                .create();
            mRetrofit = new Retrofit.Builder()
                    .baseUrl(BASE_URL)
                    .addConverterFactory(GsonConverterFactory.create(gson))
                    .build();
    }
    return mRetrofit;
}
Run Code Online (Sandbox Code Playgroud)

}

我得到的错误非常普遍,我不知道下一步该去哪里。

2019-03-03 07:15:15.774 21769-21769/com.instreamwater.app E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.instreamwater.app, PID: 21769
java.lang.BootstrapMethodError: Exception from call site #0 bootstrap method
    at okhttp3.internal.Util.<clinit>(Unknown Source:111)
    at okhttp3.internal.Util.skipLeadingAsciiWhitespace(Unknown Source:0)
    at okhttp3.HttpUrl$Builder.parse(Unknown …
Run Code Online (Sandbox Code Playgroud)

android okhttp retrofit2

3
推荐指数
1
解决办法
2799
查看次数

如何使用 Firebase 在 Android Studio 项目中将记录的用户数据作为用户名检索到导航标头

我是 Android 项目的新手。我使用 Firebase 创建项目。在这个项目中,我想将记录的用户名添加到导航标题中的 textview。我用于登录或注册模型选项。但我不能。有人对这个有经验么?我的 firebase 数据库数据显示如下。在此处输入图片说明

我想要这样 在此处输入图片说明

我的家庭活动是这个

package com.cavad.firebaseproject;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;


public class Home extends AppCompatActivity
    implements NavigationView.OnNavigationItemSelectedListener {


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, 
 R.string.navigation_drawer_close);
    drawer.addDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = …
Run Code Online (Sandbox Code Playgroud)

java android firebase

2
推荐指数
1
解决办法
2629
查看次数

为什么(System.out.printf()== null)在Java中为true,PrintStream是否为null?

为什么PrintStream == null

我尝试了以下代码,它可以正常工作

if (System.out.printf("Som text") == null);
Run Code Online (Sandbox Code Playgroud)

作为printf()返回PrintStream值,为什么它等于null,请解释...

java

-3
推荐指数
1
解决办法
64
查看次数