When Android calls Wechat login jump, it does not confirm the login, but how to solve the problem when it returns to code, normally?

when sending an ordinary string, it can jump to Wechat normally, but when calling the login authorization, it returns code, without confirming the login, and then calling to get access_token is also a normal return. What"s wrong?
my code:
public class MainActivity extends AppCompatActivity {

String APP_ID ="xxx";
public static IWXAPI api;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    String[] permissionsReq = new String[] { Manifest.permission.READ_PHONE_STATE, Manifest.permission.WRITE_EXTERNAL_STORAGE };
    if(ContextCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) !=
            PackageManager.PERMISSION_GRANTED) {
        ActivityCompat.requestPermissions(this, permissionsReq, 1);
    }

    api = WXAPIFactory.createWXAPI(this, APP_ID, true);
    api.registerApp(APP_ID);
}

public void onClick(View view){
    WXTextObject textObj = new WXTextObject();
    textObj.text = "123";

    WXMediaMessage msg = new WXMediaMessage();
    msg.mediaObject = textObj;
    msg.description = "123";

    SendMessageToWX.Req req = new SendMessageToWX.Req();
    req.transaction = String.valueOf(System.currentTimeMillis());
    req.message = msg;

    api.sendReq(req);
}

public void test2(View view){
    SendAuth.Req req = new SendAuth.Req();
    req.scope = "snsapi_userinfo";
    req.state = "wechat_sdk_demo_test222";
    boolean result = api.sendReq(req);
    Toast.makeText(this, ""+ result, Toast.LENGTH_SHORT).show();
}

}

public class WXEntryActivity extends Activity implements IWXAPIEventHandler {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    MainActivity.api.handleIntent(getIntent(), this);
}

/ / @ Override
/ / protected void onNewIntent (Intent intent) {
/ / super.onNewIntent (intent);
/ / MainActivity.api.handleIntent (getIntent (), this);
/ / Log.e ("ansen", "WXEntryActivity onNewIntent");
/ /}

@Override
public void onReq(BaseReq baseReq) {

}

@Override
public void onResp(BaseResp baseResp) {
    Log.e("onResp","errCode: " + baseResp.errCode);

    if(baseResp instanceof SendAuth.Resp){
        SendAuth.Resp newResp = (SendAuth.Resp) baseResp;

        //code
        String code = newResp.code;

        Log.e("onResp","code: " + code);
        Log.e("onResp","state: " + newResp.state);
    }

}

}

manifest:
< manifest xmlns:android= "http://schemas.android.com/apk/res/android"

package="bxt.com.bxt">

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

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>


<application
    android:name="com.example.admin.test_wechat.App"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name="com.example.admin.test_wechat.MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

< / manifest >

app build.gradle

android {

compileSdkVersion 27
defaultConfig {

/ / applicationId "com.example.admin.test_wechat"

    applicationId "bxt.com.bxt"
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {
    release {
        keyAlias "bxt"
        keyPassword "12345678"
        storeFile file("release_keystore.jks")
        storePassword "12345678"
    }
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        signingConfig signingConfigs.release
    }

    debug {
        signingConfig signingConfigs.release
    }
}

}

dependencies {

implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:27.1.1"
implementation "com.android.support.constraint:constraint-layout:1.1.0"
testImplementation "junit:junit:4.12"
androidTestImplementation "com.android.support.test:runner:1.0.2"
androidTestImplementation "com.android.support.test.espresso:espresso-core:3.0.2"
//
implementation "com.tencent.mm.opensdk:wechat-sdk-android-with-mta:+"

}

Menu