java.lang.RuntimeException: Unable to instantiate activity ComponentInfo
Solution 1:
It is a problem of your Intent.
Please add your Activity
in your AndroidManifest.xml
.
When you want to make a new activity, you should register it in your AndroidManifest.xml
.
Solution 2:
You may be trying to find the view before onCreate()
which is incorrect.
public class MainActivity extends Activity {
ImageView mainImage = (ImageView) findViewById(R.id.imageViewMain); //incorrect
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
...
}
Solution 3:
There is another way to get an java.lang.RuntimeException: Unable to instantiate activity ComponentInfo exception and that is the activity that you are trying to start is abstract. I made this stupid mistake once and its very easy to overlook.