Android Proguard使我的ConnectionService为空

Android Proguard使我的ConnectionService为空,android,android-service,proguard,android-service-binding,android-proguard,Android,Android Service,Proguard,Android Service Binding,Android Proguard,我有一个片段绑定到正在运行的服务。所以为了绑定,我首先声明一个ConnectionService字段 private ServiceConnection mMyConnection = new ServiceConnection() { 
 @Override
 public void onServiceConnected(ComponentName name, IBinder service) { 
 MyService.MyBinder b

我有一个片段绑定到正在运行的服务。所以为了绑定,我首先声明一个ConnectionService字段

private ServiceConnection mMyConnection = new ServiceConnection() {

        @Override
    
    public void onServiceConnected(ComponentName name, IBinder service) {

            MyService.MyBinder binder = (MyService.MyBinder) service;

            mMyService = binder.getService();

            mMyBound = true;

            Log.d(TAG, "onServiceConnected");

            …
    
    }

    
        @Override

        public void onServiceDisconnected(ComponentName name) {

            mMyBound = false;

        }

    
    };
    
然后在
onCreate
I中

Intent intent = new Intent(getContext(), MyService.class);
    
getContext().bindService(intent, mMyConnection, Context.BIND_AUTO_CREATE);
我的Proguard-ed版本表示连接为null,并在
getContext().bindService(intent,mMyConnection,Context.BIND\u AUTO\u CREATE)行崩溃。我正在使用

buildTypes {

        release {

            minifyEnabled true
    
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

            zipAlignEnabled true

        }
    
}

您是否使用任何parcelable对象?如果您的意思是要扩展parcelable,则不使用。请尝试从proguard中排除包含此类的ServiceConnection/package,请参阅results@pvllnspk我正在使用Proguard进行模糊处理。因此,您的解决方案是不要混淆。好的,那么。您使用任何可包裹对象吗?如果您的意思是我要扩展可包裹,那么就不使用。请尝试从proguard中排除包含此类的ServiceConnection/package,然后查看results@pvllnspk我正在使用Proguard进行模糊处理。因此,您的解决方案是不要混淆。那好吧。