2016-10-19 16 views
0

私は署名のないapkのバージョンでうまく動作するアプリを作っていますが、署名されたapkを作成しようとしている間にエラーを表示しています。 :シンボル変数adapter_layoutを見つけることができません。エラー:(22,31)エラー:シンボル変数car_adapter_layoutを見つけることができません

これは私のlogcatです:

Information:Gradle tasks [:app:assembleRelease] 
C:\Users\systech\Desktop\imran\RealTimeTrackingandMonitoring\app\src\main\java\com\tracker\systechdigital\realtimetrackingandmonitoring\CarAdapter.java 
Error:(22, 31) error: cannot find symbol variable car_adapter_layout 
Error:(31, 52) error: cannot find symbol variable car_adapter_layout 
Error:(33, 71) error: cannot find symbol variable name_show_car_adapter_tvid 
Error:Execution failed for task ':app:compileReleaseJavaWithJavac'. 
> Compilation failed; see the compiler error output for details. 
Information:BUILD FAILED 
Information:Total time: 3.257 secs 
Information:4 errors 
Information:0 warnings 
Information:See complete output in console 

これは私のXMLコードです:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="50dp"> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/name_show_car_adapter_tvid" 
     android:textSize="20sp" 
     android:paddingLeft="20dp" 
     android:textColor="#f9f9f9" 
     android:layout_gravity="center" 
     /> 

</LinearLayout> 

とアダプタクラスからの呼び出し:

public class CarAdapter extends ArrayAdapter<CarModelClass> { 

    ArrayList<CarModelClass> carModelClassArrayList; 
    TextView nameShow_CarAdapterTv; 
    // private String idAuto; 
    CarModelClass carModelClass; 
    private Context context; 

    public CarAdapter(Context context, ArrayList<CarModelClass> carModelClassArrayList) { 
     super(context,R.layout.car_adapter_layout , carModelClassArrayList); 
     this.context=context; 
     this.carModelClassArrayList=carModelClassArrayList; 
    } 

    @Override 
    public View getView(int position, View convertView, ViewGroup parent) { 

     LayoutInflater layoutInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
     convertView=layoutInflater.inflate(R.layout.car_adapter_layout,parent,false); 

     nameShow_CarAdapterTv =(TextView)convertView.findViewById(R.id.name_show_car_adapter_tvid); 

     carModelClass=carModelClassArrayList.get(position); 

     nameShow_CarAdapterTv.setText(carModelClass.getName()); 

     // UserInfo.setCarListItemId(carModelClassArrayList.get(position).getIdAuto()); 


     return convertView; 
    } 

} 

+0

レイアウト名は何ですか? –

+0

car_adapter_layout – AAA

+0

LayoutInflater inflater =((Activity)コンテキスト).getLayoutInflater();を使用してみてください。 row = inflater.inflate(layoutResourceId、parent、false); –

答えて

0
このエラーを解決する方法

プロジェクトをもう一度ビルドします。このようにconvertViewを使用してみてください:

public View getView(int position, View convertView, ViewGroup parent) { 
View view; 
if (convertView == null) { 
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
    view = inflater.inflate(R.layout.car_adapter_layout, parent, false); 
} else { 
    view = convertView; 
} 

//other your code 
return view; 
} 

ただ私の答えを編集してください。

+0

レイアウトを初期化する場所はどこですか? – AAA

+0

とsuper(context、carModelClassArrayList);誤った第2引数のエラー – AAA

+0

が表示されるので、コードやレイアウトが原因ではありません。ブレークポイントを配置し、アプリケーションを1行ずつデバッグしてみてください。 – PLe

関連する問題