小编Ham*_*uhi的帖子

为什么在某些手机中出现"此应用已使用错误的配置构建"错误?

我已经在android 6中构建我的应用程序没有任何错误,但是当我在android 4.4.2中构建我的应用程序时,我收到此错误

This app has been built with an incorrect configuration.
 Please configure your build for VectorDrawableCompat.

这是我的傻瓜:

android {
    compileSdkVersion 24
    buildToolsVersion "23.0.0"
    defaultConfig {
        applicationId "com.faranegar.channel"
        minSdkVersion 11
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

注意:当我设置compileSdkVersion 23时,一切都很好并且没有任何错误.

android android-gradle-plugin

16
推荐指数
2
解决办法
2万
查看次数

对于带有旋转的视图 perform(click()) 在 espresso ui 测试中不起作用

我为我的应用程序编写了一个 espresso UI 测试,并且对于某些视图(在本例中为 ImageButton)perform(click())不起作用,也没有显示错误。这是行不通的:

   try {
        Thread.sleep(TIME_NORMAL_ELPASED);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
onView(allOf(withId(R.id.toolbar_navigation_btn)
            , isCompletelyDisplayed())).perform(click());
Run Code Online (Sandbox Code Playgroud)

这是我的 xml:

<RelativeLayout 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"
tools:context="activities.DepartFlight.fragments.AvailableFragment">

<android.support.v7.widget.Toolbar
    android:id="@+id/available_toolbar"
    android:layout_width="match_parent"
    android:layout_height="?attr/actionBarSize"
    android:layout_alignParentTop="true"
    android:background="@drawable/background_toolbar">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <ImageButton
            android:id="@+id/toolbar_navigation_btn"
            android:layout_width="@dimen/icon_toolbar"
            android:layout_height="@dimen/icon_toolbar"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_centerVertical="true"
            android:background="@drawable/button_selector"
            android:rotation="180"
            android:src="@drawable/ic_back"
            android:tint="@color/white" />

        <com.faranegar.bookflight.customView.CustomTextView
            android:id="@+id/text_toolbar_flight"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="2dp"
            android:textColor="@color/white" />

        <com.faranegar.bookflight.customView.CustomTextView
            android:id="@+id/toolbar_subtitle"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/text_toolbar_flight"
            android:layout_centerHorizontal="true"
            android:textColor="@color/white"
            android:textSize="@dimen/font_size" />

    </RelativeLayout>
</android.support.v7.widget.Toolbar>

<include
    android:id="@+id/zero_filtered_items"
    android:visibility="gone"
    layout="@layout/zero_filterd_itesm_row" />

<com.faranegar.bookflight.customView.CustomRecyclerView
    android:id="@+id/available_recycler_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_above="@+id/depart_flight_activity_footer"
    android:layout_below="@id/available_toolbar" …
Run Code Online (Sandbox Code Playgroud)

java android android-espresso

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

如何在Android TextView中为每行设置重力?

我有一个包含英语和波斯语的字符串。我想如果一行以波斯字符开头,那么该行在文本视图中从右到左显示;如果一行以英文字符开头,则该行从左到右显示。

注意:我想在文本视图中为每条线设置重力/方向。

如何在android textview中实现它。

这是我的textview xml代码:

    <TextView
        android:id="@+id/textViewContent"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentRight="true"
        android:autoLink="web"
        android:layoutDirection="rtl"
        android:gravity="start"
        android:layout_gravity="start"
        android:text="My Text"
        android:textColor="#000"
        android:textDirection="rtl" />
Run Code Online (Sandbox Code Playgroud)

android textview right-to-left left-to-right

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

从 asp.net POST 方法返回 JSON 时出现“无法转换 Unicode 字符 \\uD83C”错误

我在 MVC 项目中开发了一个 web api。我在我的 post 方法中返回一个 JToken 对象。通常我的 api 工作正常,但有时在特定数据中我收到此错误:

  "Message": "An error has occurred.",
  "ExceptionMessage": "The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8'.",
  "ExceptionType": "System.InvalidOperationException",
  "StackTrace": null,
  "InnerException": {
  "Message": "An error has occurred.",
  "ExceptionMessage": "Unable to translate Unicode character \\uD83C 
   at index 411 to specified code page."
Run Code Online (Sandbox Code Playgroud)

这是我的post方法

public JToken Post([FromBody]Classes.Search search)
    {

        Classes.ReturnSearch returnSearch = new Classes.ReturnSearch();
        try
        {
            string con = System.Configuration.ConfigurationManager.ConnectionStrings["TConnectionString"].ConnectionString;
            SqlConnection cn = new SqlConnection(con);
            SqlDataAdapter sqlDataAdapter …
Run Code Online (Sandbox Code Playgroud)

c# unicode asp.net-mvc post json.net

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