0

I get this error while debugging. I put a breakpoint somewhere in the code. The project is built and run on my device, but in debugging I get this code, which is looking for android.jar My target version of android is 2.2. I chose /appcompat_v7/bin/appcompat_v7.jar instead of android.jar, assuming this version of Android is based on appcompat_v7.jar. I don't know.... I was just assuming. Nevertheless, it's not working. I checked some of Similar Questions and I couldn't find the exactly my answer, this was the most similar problem, yet my problem wasn't solved: Eclipse java debugging: source not found This is a screenshot of the error: https://i.stack.imgur.com/6m45J.png

Thhanks. :)

package com.thenewboston.travis;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.RadioGroup;
import android.widget.RadioGroup.OnCheckedChangeListener;
import android.widget.TextView;

public class OpenedClass extends Activity implements OnClickListener,
        OnCheckedChangeListener {
    TextView question, test;
    Button returnData;
    RadioGroup selectionList;
    String gotBread;
    String setData;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.send);
        initialize();
        // Bundle gotBasket = getIntent().getExtras();
        // gotBread = gotBasket.getString("key");
        // question.setText(gotBread);
    }

    private void initialize() {
        // TODO Auto-generated method stub
        question = (TextView) findViewById(R.id.tvQuestion);
        test = (TextView) findViewById(R.id.tvText);
        returnData = (Button) findViewById(R.id.bReturn);
        returnData.setOnClickListener(this);
        selectionList = (RadioGroup) findViewById(R.id.rgAnswers);
        selectionList.setOnCheckedChangeListener(this);
    }

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        Intent person = new Intent();
        Bundle backpack = new Bundle();
        backpack.putString("answer", setData);
        person.putExtras(backpack);
        setResult(RESULT_OK, person);
        finish();
    }

    @Override
    public void onCheckedChanged(RadioGroup group, int checkedId) {
        // TODO Auto-generated method stub
        switch (checkedId) {
        case R.id.rCrazy:
            setData = "Probably right!";
            break;
        case R.id.rSexy:
            setData = "Definitely right!";
            break;
        case R.id.rBoth:
            setData = "Spot On!";
            break;
        default:
            break;
        }
        test.setText(setData);
    }
}
Community
  • 1
  • 1
Yousef
  • 393
  • 8
  • 23

2 Answers2

0

This is not an error.

You try to open the source of the class, but you only have access to the .class file (which is all you need to run it).

You can attach the code (for instance by clicking the Change attached sources button), but this is in no way mandatory.

Stultuske
  • 9,296
  • 1
  • 25
  • 37
  • So, you mean I should be able to debug the code? But the breakpoint I put won't work, only the window in the screenshot opens. PS I didn't understand what you meant: 1. "You try to open the source of the class": I assume you meant source of android.jar, not my own codes, right? 2. "but you only have access to the .class file": I though .class files are the codes, then presumably I will have access to the source of the class. – Yousef Jun 17 '15 at 07:29
  • I meant the code of the class that shows that problem. There are buttons in your IDE (or key-shortcuts) to continue debugging. getting this does not 'stop' or halt the debugging process. – Stultuske Jun 17 '15 at 10:51
  • I hit every debugging command, but every time, even in codes, I will be returned to that page. – Yousef Jun 17 '15 at 11:28
  • That is not depending on the debugging action you take, it is because you don't have the appropriate source code on your path. Your Java prog can run with having only the .class files (which is the case), but your eclipse can not show you source code it doesn't has (access to) – Stultuske Jun 24 '15 at 06:14
0

You have skip that point by pressing F8 instead of F6 cause you have limitation of it. So try this one.

Anand Savjani
  • 2,484
  • 3
  • 26
  • 39
  • In this , your ActivityNotFoundException is throwing – Anand Savjani Jun 17 '15 at 08:46
  • It runs perfectly on my device. – Yousef Jun 17 '15 at 08:56
  • I would, it is a tutorial already online. However, the problem is solved by finding the error in my code, however, my question is why it didn't enter the debug so I could check my code line by line?! I add the code as an answer. :) Thanks again. – Yousef Jun 17 '15 at 09:40
  • Your intent is empty . So you have to provide next activity in which you want to redirect and have to define it in manifest file. Intent intent = new Intent(this,YourNewActivity.class); try this one. – Anand Savjani Jun 17 '15 at 09:45
  • I am actually calling this for result, and to get back the results I needed a Bundle to put my data in it, and in the parent or caller activity read the bundle, but the result should be Intent, so an intent is created. As I said, it's a code from a tutorial, and everything works fine on my phone. http://www.mybringback.com/android-sdk/828/thenewboston-sample-projects/ – Yousef Jun 17 '15 at 10:19