关于Excel 分布式配置 com权限的问题

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了关于Excel 分布式配置 com权限的问题相关的知识,希望对你有一定的参考价值。

检索 COM 类工厂中 CLSID 为 00024500-0000-0000-C000-000000000046 的组件时失败,原因是出现以下错误: 80040154。

参考技术A http://blog.csdn.net/zhang_kevin_wei/archive/2010/06/10/5662478.aspx

关于Android6.0之后的权限问题

 

地址

https://github.com/hongyangAndroid/MPermissions

project‘s build.gradle

buildscript {
    dependencies {
        classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.4‘
    }
}

module‘s buid.gradle

apply plugin: ‘com.neenbedankt.android-apt‘

dependencies {
    apt ‘com.zhy:mpermission-compiler:1.0.0‘
    compile ‘com.zhy:mpermission-api:1.0.0‘
}

 

 

dependencise:一个就行了:compile ‘com.zhy:mpermission-api:1.0.0‘

使用方法

final int REQUECT_CODE_READ_SMS = 100;
MPermissions.requestPermissions(AnayseSmsUploadActivity.this, REQUECT_CODE_READ_SMS, Manifest.permission.READ_SMS);

 

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
MPermissions.onRequestPermissionsResult(this, requestCode, permissions, grantResults);
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}

//请求成功
@PermissionGrant(REQUECT_CODE_READ_SMS)
public void requestSdcardSuccess() {


}
//请求失败

@PermissionDenied(REQUECT_CODE_READ_SMS)
public void requestSdcardFailed() {
finash();
}



MPermissions

基于Annotation Processor的简单易用的处理Android M运行时权限的库。

部分代码来自PermissionGen, 主要是将其基于运行时注解的实现修改为Annotation Processor的方式,即编译时注解。

引入

project‘s build.gradle

buildscript {
    dependencies {
        classpath ‘com.neenbedankt.gradle.plugins:android-apt:1.4‘
    }
}

module‘s buid.gradle

apply plugin: ‘com.neenbedankt.android-apt‘

dependencies {
    apt ‘com.zhy:mpermission-compiler:1.0.0‘
    compile ‘com.zhy:mpermission-api:1.0.0‘
}

使用

  • 申请权限
MPermissions.requestPermissions(MainActivity.this, REQUECT_CODE_SDCARD, Manifest.permission.WRITE_EXTERNAL_STORAGE);
  • 处理权限回调
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
{
    MPermissions.onRequestPermissionsResult(this, requestCode, permissions, grantResults);
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
  • 是否需要弹出解释
if (!MPermissions.shouldShowRequestPermissionRationale(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE, REQUECT_CODE_SDCARD))
{
    MPermissions.requestPermissions(MainActivity.this, REQUECT_CODE_SDCARD, Manifest.permission.WRITE_EXTERNAL_STORAGE);
}

如果需要解释,会自动执行使用@ShowRequestPermissionRationale注解的方法。

授权成功以及失败调用的分支方法通过注解@PermissionGrant@PermissionDenied进行标识,详细参考下面的例子或者sample。

例子

  • in Activity:
public class MainActivity extends AppCompatActivity
{

    private Button mBtnSdcard;
    private static final int REQUECT_CODE_SDCARD = 2;

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

        mBtnSdcard = (Button) findViewById(R.id.id_btn_sdcard);
        mBtnSdcard.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                MPermissions.requestPermissions(MainActivity.this, REQUECT_CODE_SDCARD, Manifest.permission.WRITE_EXTERNAL_STORAGE);
            }
        });
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
    {
        MPermissions.onRequestPermissionsResult(this, requestCode, permissions, grantResults);
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    }


    @PermissionGrant(REQUECT_CODE_SDCARD)
    public void requestSdcardSuccess()
    {
        Toast.makeText(this, "GRANT ACCESS SDCARD!", Toast.LENGTH_SHORT).show();
    }

    @PermissionDenied(REQUECT_CODE_SDCARD)
    public void requestSdcardFailed()
    {
        Toast.makeText(this, "DENY ACCESS SDCARD!", Toast.LENGTH_SHORT).show();
    }
}
  • in Fragment:
public class TestFragment extends Fragment
{
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
        return inflater.inflate(R.layout.fragment_test, container, false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState)
    {
        view.findViewById(R.id.id_btn_contact).setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                MPermissions.requestPermissions(TestFragment.this, 4, Manifest.permission.WRITE_CONTACTS);
            }
        });

    }

    @PermissionGrant(4)
    public void requestContactSuccess()
    {
        Toast.makeText(getActivity(), "GRANT ACCESS CONTACTS!", Toast.LENGTH_SHORT).show();
    }

    @PermissionDenied(4)
    public void requestContactFailed()
    {
        Toast.makeText(getActivity(), "DENY ACCESS CONTACTS!", Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
    {
        MPermissions.onRequestPermissionsResult(this, requestCode, permissions, grantResults);
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
    }
}

混淆

-dontwarn com.zhy.m.**
-keep class com.zhy.m.** {*;}
-keep interface com.zhy.m.** { *; }
-keep class **$$PermissionProxy { *; }























以上是关于关于Excel 分布式配置 com权限的问题的主要内容,如果未能解决你的问题,请参考以下文章

Apollo分布式配置中心部署以及使用

Apollo分布式配置中心简易环境部署

DCOM EXCE权限配置问题

pollo分布式配置中心部署以及使用(转发)

hadoop伪分布式配置修改配置文件的时候无法保存(没有权限保存)

nacos源码之Auth(权限)模块-2(权限管理与权限配置)