What is wrong with the creation of activity and the eighth android?

I create activity in the "dialog style" for inAppBilling. It works on all test devices, and according to the glassrack with GP it regularly “falls” on phones with Android 8.0 in the 31st line.

Code as from the tutorial:

public class ActivityBuy extends AppCompatActivity { IabHelper mHelper; public static final int BUY_CODE = 13; IInAppBillingService mService; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // <== строка 31 setContentView(R.layout.dialog_buy); findViewById(R.id.dialogExit).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); findViewById(R.id.dialogBuy).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { buyFullResolve(); } catch (RemoteException e) { e.printStackTrace(); } finish(); } }); Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND"); serviceIntent.setPackage("com.android.vending"); bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE); String base64EncodedPublicKey = getString(R.string.licence); mHelper = new IabHelper(this, base64EncodedPublicKey); mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() { public void onIabSetupFinished(IabResult result) { if (!result.isSuccess()) { Log.d("ttt", "Problem setting up In-app Billing: " + result); } else { Log.d("ttt", "Success: " + result); mHelper.queryInventoryAsync(mGotInventoryListener); } } }); } IabHelper.QueryInventoryFinishedListener mGotInventoryListener = new IabHelper.QueryInventoryFinishedListener() { public void onQueryInventoryFinished(IabResult result, Inventory inventory) { if (result.isFailure()) { StaticToaster.makeToaster(getLayoutInflater(), ActivityBuy.this, getString(R.string.noconnection), true, true); } else { // } } }; public void buyFullResolve() throws RemoteException { ArrayList<String> skuList = new ArrayList<String>(); skuList.add(getString(R.string.buyFullID)); Bundle querySkus = new Bundle(); querySkus.putStringArrayList("ITEM_ID_LIST", skuList); try { if (mHelper != null) mHelper.flagEndAsync(); mHelper.launchPurchaseFlow(this, getString(R.string.buyFullID), BUY_CODE, mPurchaseFinishedListener, getString(R.string.randomKey)); } catch (IllegalStateException e) { StaticToaster.makeToaster(getLayoutInflater(), this, "Покупка не удалась. Попробуйте через несколько секунд.", false, false); } } IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener = new IabHelper.OnIabPurchaseFinishedListener() { public void onIabPurchaseFinished(IabResult result, Purchase purchase) { if (result.isFailure()) { Log.d("ttt", "Error purchasing: " + result); setResult(RESULT_CANCELED); } else if (purchase.getSku().equals(getString(R.string.buyFullID))) { MyLab.get(ActivityBuy.this).setFullVersion(true); StaticToaster.makeToaster(getLayoutInflater(), ActivityBuy.this, getString(R.string.fullSuccess), false, false); setResult(RESULT_OK); finish(); } } }; ServiceConnection mServiceConn = new ServiceConnection() { @Override public void onServiceDisconnected(ComponentName name) { mService = null; } @Override public void onServiceConnected(ComponentName name, IBinder service) { mService = IInAppBillingService.Stub.asInterface(service); } }; private void queryPurchasedItems() { if (mHelper.isSetupDone() && !mHelper.isAsyncInProgress()) { mHelper.queryInventoryAsync(mGotInventoryListener); } } 

The topic is written in the manifest: android:theme="@style/myDialogStyle"

 <style name="myDialogStyle" parent="Theme.AppCompat.Dialog.Alert"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style> 

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="wrap_content" android:orientation="vertical"> <TextView style="@style/textStyle" android:text="@string/buyFullHeader" android:id="@+id/header"/> <TextView android:id="@+id/dialogHeaderText" style="@style/textStyle" android:text="@string/buyFullVersion" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <Button android:id="@+id/dialogExit" android:text="@string/back" style="@style/dialogButton"/> <Button android:id="@+id/dialogBuy" android:text="@string/buy" style="@style/dialogButton"/> </LinearLayout> 

And here are the stackraces with GP: GP stackrays

Gradle:

 compileSdkVersion 27 buildToolsVersion "27.0.3" defaultConfig { applicationId "id" minSdkVersion 14 targetSdkVersion 27 versionCode 1 versionName "1.1" } 

The rest of the activity starts normally.

I sin on the topic, but I do not know what the matter is. Maybe someone came across, tell me.

    1 answer 1

    I decided. The error was in the line android:screenOrientation="portrait" in the manifest.

    Judging by the comments on the English SO on Android 8.0 for activities that are not "fullscreen", you should not set the orientation.

    Removed the above line, everything works.