小编Era*_*ise的帖子

mkdirs aways 在 Android 5.1 中返回 false

我搜索了这些问题,但无法解决。请帮我解决这个问题

那是我的 mkdir 代码:

File _sdcardPath = Environment.getExternalStorageDirectory(); // sdcard path is /storage/emulate/0
File _dirPath = new File(_sdcardPath, "CreateFolder");
boolean _isCreate = _dirPath.mkdir();
if (_isCreate) {
   tvResult.append(_dirPath + " mkdir success");
} else {
   tvResult.append(_dirPath + " mkdir fail");
}
Run Code Online (Sandbox Code Playgroud)

我的 manifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.createfolder"
    android:versionCode="1"
    android:versionName="1.0" >

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

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="21" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>
Run Code Online (Sandbox Code Playgroud)

我的设备android版本是:5.1.1,12GB可用空间,代码在5.0下正常运行

在运行应用程序时,我遇到了这个异常: …

android exception-handling

5
推荐指数
1
解决办法
518
查看次数

Android Gradle依赖本地库使用Nexus

我在 AndroidStudio 上工作,我有一个项目的结构:

我的项目1

  • |--- 模块公共
  • |--- ModuleSocket(依赖ModuleCommon)
  • |--- 模块演示

我想将 ModuleCommon 和 ModuleDemo 上传到我的本地 nexus 服务,我将在其他项目中使用 ModuleCommon 或(和)ModuleSocket,即我的 gradle 脚本(片段):

  • ModuleCommon - build.gradle:
apply plugin: 'maven'
def isReleaseBuild() {
    return VERSION_NAME.contains("SNAPSHOT") == false
}
def getRepositoryUsername() {
    return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
}
def getRepositoryPassword() {
    return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
}
afterEvaluate { project ->
    uploadArchives {
        repositories {
            mavenDeployer {
                pom.groupId = GROUP
                pom.artifactId = "ModuleCommon"
                pom.version = "0.0.1"
                repository(url: RELEASE_REPOSITORY_URL) {
                    authentication(userName: getRepositoryUsername(), password: …
Run Code Online (Sandbox Code Playgroud)

android sonatype gradle android-studio-2.0

2
推荐指数
1
解决办法
1985
查看次数