2012-05-26 14 views
7

私はアンドロイドプロジェクトを実行しようとしています。プロジェクトにはプロジェクトフォルダに赤いxが付いていますが、サブフォルダには赤いxがありません。エラーを示すコードは強調表示されません。残念ながら私のプロジェクトは実行されていません。プロジェクトとして実行すると、このエラーが表示されます。アンドロイドプロジェクトは赤いxですが、コードにエラーはありません

enter image description here

それはどちらかの問題]タブにエラーが表示されません。

この問題を解決するにはどうすればよいですか?

私のJavaのビルド・パス

enter image description here

編集

ここにここに私のコード

public class AndroidLoginActivity extends Activity implements OnClickListener { 
EditText username, password; 
Button login; 

String user, pass; 
HttpClient httpclient; 
HttpPost httppost; 
ArrayList<NameValuePair> nameValuePair; 
HttpResponse response; 
HttpEntity entity; 

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.main); 
    initialise(); 
} 

private void initialise() { 
    // TODO Auto-generated method stub 
    username = (EditText)findViewById(R.id.etUsername); 
    password = (EditText)findViewById(R.id.etPassword); 
    login = (Button)findViewById(R.id.btnLogin); 

    login.setOnClickListener(this); 
} 

public void onClick(View v) { 
    httpclient = new DefaultHttpClient(); 
    httppost = new HttpPost("http://10.0.2.2/android_login/index.php"); 

    user = username.getText().toString(); 
    pass = password.getText().toString(); 

    try { 
     nameValuePair = new ArrayList<NameValuePair>(); 

     nameValuePair.add(new BasicNameValuePair("username", user)); 
     nameValuePair.add(new BasicNameValuePair("password", pass)); 
     httppost.setEntity(new UrlEncodedFormEntity(nameValuePair)); 
     response = httpclient.execute(httppost); 
     if(response.getStatusLine().getStatusCode() == 200) { 
      entity = response.getEntity(); 

      if(entity != null) { 
       InputStream instream = entity.getContent(); 
       JSONObject jsonResponse = new JSONObject(convertStreamToString(instream)); 
       String retUser = jsonResponse.getString("username"); //mysql table field 
       String retPass = jsonResponse.getString("password"); 

       if(username.equals(retUser) && password.equals(retPass)) { 
        SharedPreferences sp = getSharedPreferences("logindetails",0); 
        SharedPreferences.Editor spedit = sp.edit(); 
        spedit.putString("user", user); 
        spedit.putString("pass", pass); 
        spedit.commit(); 
        Toast.makeText(getBaseContext(), "Success", Toast.LENGTH_SHORT).show(); 
       } else { 
        Toast.makeText(getBaseContext(), "Login Failed", Toast.LENGTH_SHORT).show(); 
       } 
      } 
     } 
    } catch (Exception e) { 
     e.printStackTrace(); 
     Toast.makeText(getBaseContext(), "Login Failed", Toast.LENGTH_SHORT).show(); 
    } 
} 

public static String convertStreamToString(InputStream is) { 
    BufferedReader reader = new BufferedReader(new InputStreamReader(is)); 
    StringBuilder sb = new StringBuilder(); 

    String line = null; 
    try { 
     while((line = reader.readLine()) != null) { 
      sb.append(line + "\n"); 
     } 
    } catch (IOException e) { 
     e.printStackTrace(); 
    } finally { 
     try { 
      is.close(); 
     } catch(IOException e) { 
      e.printStackTrace(); 
     } 
    } 
    return sb.toString(); 
} 
} 

である私のmain.xmlは

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

<EditText 
    android:id="@+id/etUsername" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="Username..." > 

</EditText> 

<EditText 
    android:id="@+id/etPassword" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:inputType="textPassword" 
    android:text="Password..." /> 

<Button 
    android:id="@+id/btnLogin" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="Login" /> 

</LinearLayout> 
ですここ

は、他の誰かが同じ問題を抱えている場合は、それらを見つけるためにのためにとても簡単になりますように、私は自分の質問に答えるのです私のmenifestファイル

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.zafar.androidlogin" 
android:versionCode="1" 
android:versionName="1.0" > 

<uses-sdk android:minSdkVersion="10" /> 
<uses-permission android:name="android.permission.INTERNET"/> 

<application 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" > 
    <activity 
     android:name=".AndroidLoginActivity" 
     android:label="@string/app_name" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
</application> 

</manifest> 

エラーログ

enter image description here

+0

@alOne evening:コンパイル時エラーですので、どのクラスやレイアウトなどに赤いマークが入っているのかを見てください。 – Ashwin

+0

サブフォルダーに赤いxがありません。私はこの赤いxをprjectフォルダにしか見ません。 – 2619

+0

@alOne evening:manifest.xmlファイルに登録されているすべてのアクティビティですか? – Ashwin

答えて

4

ですその解決策。

ソリューションは、私はその後、私はプロジェクトをクリーンアップし、それが動作します。このパスC:\Users\Administrator\.android

上に存在するファイルdebug.keystoreを削除しました。

0

プロジェクトを右クリック→アンドロイドツール→アンドロイドサポートライブラリ

関連する問題