CriminalIntent crash after converting to AppCompat library


#1

Hi, I’m following the tutorial on Android Programming (2nd Edition).
On chapter 13 they introduce the AppCompat library in order to have a toolbar.
When I change the SingleFragmentActivity to extends AppCompat library the app will crash.
If I change only CrimePagerActivity the app still works.

I don’t understand where is the problem?


#2

I finally found the solution.
In my Project Structure -> Dependencies I’ve had “com.android.support:appcompat-v7:26.1.0”, so I’ve thought I didn’t need to add the AppCompat library dependency.
I’ve tried to add a new library and I’ve searched for “appcompat” when I found “com.android.support:appcompat-v7:27.1.0” that looks like a newer version of the same library. After I’ve added it the app now works and show the toolbar.