Java 应用程序停止工作:找不到类';android.graphics.drawable.RippleDrawable';

Java 应用程序停止工作:找不到类';android.graphics.drawable.RippleDrawable';,java,android,rippledrawable,Java,Android,Rippledrawable,我是android新手,我开发了一个应用程序,使用Google places autocomplete和recycle view。 当我尝试运行该应用程序时,它不工作并显示 找不到类“android.graphics.drawable.RippleDrawable”, 引用自方法 android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering 有一些问题与此相关,但其中任何一个都不能解决我的问题 这是我的活动搜索bus

我是android新手,我开发了一个应用程序,使用Google places autocomplete和recycle view。 当我尝试运行该应用程序时,它不工作并显示

找不到类“android.graphics.drawable.RippleDrawable”, 引用自方法 android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering

有一些问题与此相关,但其中任何一个都不能解决我的问题

这是我的活动搜索bus.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.busgeni.busgeni.SearchBus">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentEnd="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:gravity="center_horizontal"
    android:orientation="vertical">

    <EditText
        android:id="@+id/idsource_txt"
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        android:layout_margin="50dp"
        android:background="@drawable/write_text"
        android:drawableLeft="@drawable/ic_search_black_24dp"
        android:drawablePadding="10dp"
        android:hint="@string/source_point"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:singleLine="true"
        android:textColorHint="#c6c6c6" />

    <EditText
        android:id="@+id/iddestination_txt"
        android:layout_width="300dp"
        android:layout_height="wrap_content"
        android:layout_margin="0dp"
        android:background="@drawable/write_text"
        android:drawableLeft="@drawable/ic_search_black_24dp"
        android:drawablePadding="10dp"
        android:hint="@string/destination_point"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:singleLine="true"
        android:textColorHint="#c6c6c6" />


    <Button
        android:id="@+id/searchbutton"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_margin="60dp"
        android:background="#1A237E"
        android:padding="10dp"
        android:text="@string/search_button"
        android:textColor="#FFFFFF"
        android:textSize="25sp" />

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView_source"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:layout_below="@+id/idsource_txt"
        android:layout_marginTop="10dp"
        android:scrollbars="vertical" />

    <android.support.v7.widget.RecyclerView
        android:id="@+id/recyclerView_des"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:layout_below="@+id/iddestination_txt"
        android:layout_marginTop="10dp"
        android:scrollbars="vertical" />

</LinearLayout>

</RelativeLayout>

search_row.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="65dp"
android:id="@+id/idsearch_row"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:layout_centerVertical="true"
android:background="@drawable/write_text"
android:gravity="center_horizontal">

<ImageView
    android:id="@+id/locationimg"
    android:layout_width="22dp"
    android:layout_height="22dp"
    android:src="@drawable/ic_location_on_black_18dp"
    android:layout_marginLeft="10dp"
    android:layout_marginTop="20dp"/>

<TextView
    android:id="@+id/location"
    android:layout_width="match_parent"
    android:layout_height="40dp"
    android:layout_marginTop="22dp"
    android:textColor="#000"
    android:textSize="15sp"
    android:layout_toRightOf="@+id/locationimg"
    android:layout_marginBottom="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginLeft="20dp"/>

</RelativeLayout>

SearchBus.java

package com.example.busgeni.busgeni;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.example.busgeni.busgeni.Adapters.AT_Adapter;
import com.example.busgeni.busgeni.Listeners.Recycler_Listener;
import com.example.busgeni.busgeni.Utility.Constants;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.common.api.ResultCallback;
import com.google.android.gms.location.LocationServices;
import com.google.android.gms.location.places.PlaceBuffer;
import com.google.android.gms.location.places.Places;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;

public class SearchBus extends AppCompatActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, View.OnClickListener
{
    GoogleApiClient my_client;

    private static final LatLngBounds my_Bounds = new LatLngBounds(
            new LatLng(-0, 0), new LatLng(0, 0));

    private EditText my_source, my_destination;
    private RecyclerView my_Recycle_source, my_Recycle_destination;
    private LinearLayoutManager my_Layout_Manager;
    private AT_Adapter my_AT_Adapter;

    private static Button search_btn;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        buildGoogleApiClient();

        setContentView(R.layout.activity_search_bus);

        my_source = (EditText)findViewById(R.id.idsource_txt);
        my_destination = (EditText)findViewById(R.id.iddestination_txt);

        my_AT_Adapter =  new AT_Adapter(this, R.layout.search_row,
                my_client, my_Bounds, null);

        my_Recycle_source=(RecyclerView)findViewById(R.id.recyclerView_source);
        my_Recycle_destination=(RecyclerView)findViewById(R.id.recyclerView_des);
        my_Layout_Manager=new LinearLayoutManager(this);

        my_Recycle_source.setLayoutManager(my_Layout_Manager);
        my_Recycle_source.setAdapter(my_AT_Adapter);
        my_Recycle_destination.setLayoutManager(my_Layout_Manager);
        my_Recycle_destination.setAdapter(my_AT_Adapter);

       // delete.setOnClickListener(this);

        my_source.addTextChangedListener(new TextWatcher()
        {
            public void onTextChanged(CharSequence s, int start, int before, int count)
            {
                if (!s.toString().equals("") && my_client.isConnected())
                {
                    my_AT_Adapter.getFilter().filter(s.toString());
                } else if(!my_client.isConnected())
                {
                    Toast.makeText(getApplicationContext(), Constants.API_NOT_CONNECTED,Toast.LENGTH_SHORT).show();
                    Log.e(Constants.PlacesTag,Constants.API_NOT_CONNECTED);
                }

            }

            public void beforeTextChanged(CharSequence s, int start, int count,
                                          int after) {

            }

            public void afterTextChanged(Editable s) {

            }
        });

        my_destination.addTextChangedListener(new TextWatcher()
        {
            public void onTextChanged(CharSequence s, int start, int before, int count)
            {
                if (!s.toString().equals("") && my_client.isConnected())
                {
                    my_AT_Adapter.getFilter().filter(s.toString());
                } else if(!my_client.isConnected())
                {
                    Toast.makeText(getApplicationContext(), Constants.API_NOT_CONNECTED,Toast.LENGTH_SHORT).show();
                    Log.e(Constants.PlacesTag,Constants.API_NOT_CONNECTED);
                }

            }

            public void beforeTextChanged(CharSequence s, int start, int count,
                                          int after) {

            }

            public void afterTextChanged(Editable s) {

            }
        });

        my_Recycle_source.addOnItemTouchListener( new Recycler_Listener(this, new Recycler_Listener.OnItemClickListener() {
                    @Override
                    public void onItemClick(View view, int position) {
                        final AT_Adapter.PlaceAutocomplete item = my_AT_Adapter.getItem(position);
                        final String placeId = String.valueOf(item.placeId);
                        Log.i("TAG", "Autocomplete item selected: " + item.description);
                        /*
                             Issue a request to the Places Geo Data API to retrieve a Place object with additional details about the place.
                         */

                        PendingResult<PlaceBuffer> placeResult = Places.GeoDataApi
                                .getPlaceById(my_client, placeId);
                        placeResult.setResultCallback(new ResultCallback<PlaceBuffer>() {
                            @Override
                            public void onResult(PlaceBuffer places) {
                                if(places.getCount()==1){
                                    //Do the things here on Click.....
                                    Toast.makeText(getApplicationContext(),String.valueOf(places.get(0).getLatLng()),Toast.LENGTH_SHORT).show();
                                }else {
                                    Toast.makeText(getApplicationContext(),Constants.SOMETHING_WENT_WRONG,Toast.LENGTH_SHORT).show();
                                }
                            }
                        });
                        Log.i("TAG", "Clicked: " + item.description);
                        Log.i("TAG", "Called getPlaceById to get Place details for " + item.placeId);
                    }
                })
        );

        my_Recycle_destination.addOnItemTouchListener( new Recycler_Listener(this, new Recycler_Listener.OnItemClickListener() {
                    @Override
                    public void onItemClick(View view, int position) {
                        final AT_Adapter.PlaceAutocomplete item = my_AT_Adapter.getItem(position);
                        final String placeId = String.valueOf(item.placeId);
                        Log.i("TAG", "Autocomplete item selected: " + item.description);
                        /*
                             Issue a request to the Places Geo Data API to retrieve a Place object with additional details about the place.
                         */

                        PendingResult<PlaceBuffer> placeResult = Places.GeoDataApi
                                .getPlaceById(my_client, placeId);
                        placeResult.setResultCallback(new ResultCallback<PlaceBuffer>() {
                            @Override
                            public void onResult(PlaceBuffer places) {
                                if(places.getCount()==1){
                                    //Do the things here on Click.....
                                    Toast.makeText(getApplicationContext(),String.valueOf(places.get(0).getLatLng()),Toast.LENGTH_SHORT).show();
                                }else {
                                    Toast.makeText(getApplicationContext(),Constants.SOMETHING_WENT_WRONG,Toast.LENGTH_SHORT).show();
                                }
                            }
                        });
                        Log.i("TAG", "Clicked: " + item.description);
                        Log.i("TAG", "Called getPlaceById to get Place details for " + item.placeId);
                    }
                })
        );

        onClickButtonListener();
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        return true;
    }

    /*@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }*/

    public void onClickButtonListener() {
        search_btn = (Button) findViewById(R.id.searchbutton);
        search_btn.setOnClickListener(
                new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent("com.example.busgeni.busgeni.SearchResult");
                        startActivity(intent);
                    }
                }
        );
    }

    @Override
    public void onStart() {
        super.onStart();

    }

    @Override
    public void onStop() {
        super.onStop();

    }

    @Override
    public void onResume()
    {
        super.onResume();
        if (!my_client.isConnected() && !my_client.isConnecting()){
            Log.v("Google API","Connecting");
            my_client.connect();
        }
    }

    @Override
    public void onPause() {
        super.onPause();
        if(my_client.isConnected()){
            Log.v("Google API","Dis-Connecting");
            my_client.disconnect();
        }
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
    }

    @Override
    public void onConnected(@Nullable Bundle bundle) {
        Log.v("Google API Callback", "Connection Done");
    }

    @Override
    public void onConnectionSuspended(int i) {
        Log.v("Google API Callback", "Connection Suspended");
        Log.v("Code", String.valueOf(i));
    }

    @Override
    public void onClick(View v) {
        /*if(v==delete){
            my_source.setText("");
        }*/
    }

    @Override
    public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
        Log.v("Google API Callback","Connection Failed");
        Log.v("Error Code", String.valueOf(connectionResult.getErrorCode()));
        Toast.makeText(this, Constants.API_NOT_CONNECTED,Toast.LENGTH_SHORT).show();
    }

    protected synchronized void buildGoogleApiClient() {
        my_client = new GoogleApiClient.Builder(this)
                .addConnectionCallbacks(this)
                .addOnConnectionFailedListener(this)
                .addApi(LocationServices.API)
                .addApi(Places.GEO_DATA_API)
                .build();
    }
}
package com.example.busgeni.busgeni;
导入android.content.Intent;
导入android.support.annotation.NonNull;
导入android.support.annotation.Nullable;
导入android.support.v7.app.AppActivity;
导入android.os.Bundle;
导入android.support.v7.widget.LinearLayoutManager;
导入android.support.v7.widget.RecyclerView;
导入android.text.Editable;
导入android.text.TextWatcher;
导入android.util.Log;
导入android.view.Menu;
导入android.view.MenuItem;
导入android.view.view;
导入android.widget.Button;
导入android.widget.EditText;
导入android.widget.Toast;
导入com.example.busgeni.busgeni.Adapters.AT_Adapter;
导入com.example.busgeni.busgeni.Listeners.Recycler\u Listener;
导入com.example.busgeni.busgeni.Utility.Constants;
导入com.google.android.gms.common.ConnectionResult;
导入com.google.android.gms.common.api.GoogleAppClient;
导入com.google.android.gms.common.api.pendingreult;
导入com.google.android.gms.common.api.ResultCallback;
导入com.google.android.gms.location.LocationServices;
导入com.google.android.gms.location.place.PlaceBuffer;
导入com.google.android.gms.location.places.places;
导入com.google.android.gms.maps.model.LatLng;
导入com.google.android.gms.maps.model.LatLngBounds;
公共类SearchBus扩展AppCompativeActivity实现GoogleAppClient.ConnectionCallbacks、GoogleAppClient.OnConnectionFailedListener、View.OnClickListener
{
GoogleapClient是我的客户;
私有静态最终LatLngBounds my_Bounds=新LatLngBounds(
新LatLng(-0,0),新LatLng(0,0));
私有编辑文本我的源,我的目的地;
私人回收站查看我的回收站、我的回收站;
私人线路布局经理我的布局经理;
专用AT_适配器my_AT_适配器;
专用静态按钮搜索\u btn;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
buildGoogleAppClient();
setContentView(R.layout.activity\u search\u总线);
my_source=(EditText)findViewById(R.id.idsource_txt);
my_destination=(EditText)findViewById(R.id.iddestination_txt);
my_AT_Adapter=新建AT_Adapter(此,R.layout.search_行,
我的客户机,我的边界,空);
my_Recycle_source=(RecyclerView)findViewById(R.id.RecyclerView_source);
my_Recycle_destination=(RecyclerView)findViewById(R.id.RecyclerView_des);
my_Layout_Manager=新的LinearLayoutManager(此);
my_Recycle_source.setLayoutManager(my_Layout_Manager);
my_Recycle_source.setAdapter(my_AT_Adapter);
my_Recycle_destination.setLayoutManager(my_Layout_Manager);
my_Recycle_destination.setAdapter(my_AT_Adapter);
//delete.setOnClickListener(此);
my_source.addTextChangedListener(新的TextWatcher()
{
public void onTextChanged(字符序列、int start、int before、int count)
{
如果(!s.toString().equals(“”)&&my_client.isConnected())
{
my_AT_Adapter.getFilter().filter(s.toString());
}如果(!my_client.isConnected())
{
Toast.makeText(getApplicationContext(),Constants.API\u NOT\u CONNECTED,Toast.LENGTH\u SHORT).show();
Log.e(Constants.PlacesTag,Constants.API\u未连接);
}
}
更改前的公共无效(字符序列、整数开始、整数计数、,
整数后){
}
公共无效后文本已更改(可编辑){
}
});
my_destination.addTextChangedListener(新的TextWatcher()
{
public void onTextChanged(字符序列、int start、int before、int count)
{
如果(!s.toString().equals(“”)&&my_client.isConnected())
{
my_AT_Adapter.getFilter().filter(s.toString());
}如果(!my_client.isConnected())
{
Toast.makeText(getApplicationContext(),Constants.API\u NOT\u CONNECTED,Toast.LENGTH\u SHORT).show();
Log.e(Constants.PlacesTag,Constants.API\u未连接);
}
}
更改前的公共无效(字符序列、整数开始、整数计数、,
整数后){
}
公共无效后文本已更改(可编辑){
}
});
my_Recycle_source.addOnItemTouchListener(新回收者_监听器)(这个,新回收者_监听器.OnItemClickListener(){
@凌驾
公共虚线单击(视图,int位置){
final AT_Adapter.PlaceAutocomplete item=my_AT_Adapter.getItem(位置);
最终字符串placeId=String.valueOf(item.placeId);
Log.i(“标记”,“所选自动完成项目:“+项目.说明”);
/*
向Places Geo Data API发出请求,以检索包含有关地点的其他详细信息的地点对象。
*/
Pendingreult placeResult=Places.GeoDataApi
.getPlaceById(我的客户,placeId);
placeResu