当前位置: 首页 > article >正文

Android Studio报错: Could not find pub.devrel:easypermissions:0.3.0, 改用linux编译

在Android studio中去编译开源的仓库,大概率就是各种编译不过,一堆错误,一顿改错,基本上会耗费非常多时间,比如:

这个就是改gradle版本,改成7.2 ,修改完成之后,还有其他报错: 

Execution failed for task ':app:checkDebugDuplicateClasses'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Could not find pub.devrel:easypermissions:0.3.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/pub/devrel/easypermissions/0.3.0/easypermissions-0.3.0.pom
       - https://jcenter.bintray.com/pub/devrel/easypermissions/0.3.0/easypermissions-0.3.0.pom
       - https://jitpack.io/pub/devrel/easypermissions/0.3.0/easypermissions-0.3.0.pom
       - https://dl.bintray.com/thelasterstar/maven/pub/devrel/easypermissions/0.3.0/easypermissions-0.3.0.pom
     Required by:
         project :app
   > Could not find com.danikula:videocache:2.7.0.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/danikula/videocache/2.7.0/videocache-2.7.0.pom
       - https://jcenter.bintray.com/com/danikula/videocache/2.7.0/videocache-2.7.0.pom
       - https://jitpack.io/com/danikula/videocache/2.7.0/videocache-2.7.0.pom
       - https://dl.bintray.com/thelasterstar/maven/com/danikula/videocache/2.7.0/videocache-2.7.0.pom
     Required by:
         project :app

主要原因还是因为国外仓库无法下载,可以使用国内仓库: 

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
        maven { url "https://dl.bintray.com/thelasterstar/maven/" }

       maven { url 'https://maven.aliyun.com/repository/google' }

     maven { url 'https://maven.aliyun.com/repository/jcenter' }
     maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }

    }
}

 最后还是报错, 所以换一种编译方法, 直接在linux系统中编译,当前使用的ubuntu18.04  X86

1, 下载源码

git clone  https://gitee.com/xiaotaoge/AndroidCamera.git

2, 下载sdk

mkdir -p ~/sdk/cmdline-tools
cd ~/sdk/cmdline-tools
wget https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip
unzip commandlinetools-linux-8512546_latest.zip
mv cmdline-tools/ latest
cd ..
echo y | ./cmdline-tools/latest/bin/sdkmanager emulator 
echo y | ./cmdline-tools/latest/bin/sdkmanager "platform-tools" "platforms;android-28" 

 3,设置环境android sdk的环境变量

export ANDROID_HOME=~/sdk

export PATH=~/sdk/cmdline-tools/latest/bin:/home/ctgcdt/sdk/platform-tools:$PATH

4,修改gradle地址,否则下载很慢

cd AndroidCamera/

vim gradle/wrapper/gradle-wrapper.properties
#Fri May 04 17:34:33 CST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-4.4-all.zip

5, 修改依赖仓库, 增加国内阿里仓库,否则很多依赖下载不了

修改文件: AndroidCamera$ vim build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
        maven { url "https://dl.bintray.com/thelasterstar/maven/" }

      maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
//        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
        maven { url "https://dl.bintray.com/thelasterstar/maven/" }

        maven { url 'https://maven.aliyun.com/repository/google' }
        maven { url 'https://maven.aliyun.com/repository/jcenter' }
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public' }

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}
~
 

6,编译

./gradlew

7,根据出错,下载对应sdk

sdkmanager "build-tools;27.0.3"
sdkmanager "platforms;android-27"

8,编译

 ./gradlew
 ./gradlew tasks
 ./gradlew assembleDebug

9, 报错

a, 无法下载EpMedia-v0.9.5.aar
https://jitpack.io/com/github/yangjie10930/EpMedia/v0.9.5/EpMedia-v0.9.5.aar

我是通过FQ解决。 

9,最后生成apk

./app/build/outputs/apk/debug/app-debug.apk 


http://www.kler.cn/a/310883.html

相关文章:

  • 记录使用documents4j来将word文件转化为pdf文件
  • 灰狼优化算法
  • 数据结构-集合
  • 机器情绪及抑郁症算法
  • Objection
  • Ollama的安装以及大模型下载教程
  • 在线考试|基于java的模拟考试系统小程序(源码+数据库+文档)
  • Modbus_RTU和Modbus库
  • 1.Seata 1.5.2 seata-server搭建
  • 线程池的类型和状态
  • sqli-labs靶场自动化利用工具——第11关
  • 【深度学习】(2)--PyTorch框架认识
  • 设计模式(Design Patterns)
  • springBoot整合mybatisplus
  • 学习风格的类型
  • 内核是如何接收网络包的
  • FLUX屠榜了小红书,平台这会也真假难辨
  • PMP 报考条件是有哪些?
  • 【mysql】mysql中窗口函数lag()用法
  • HarmonyOS开发实战( Beta5.0)蓝牙实现服务端和客户端通讯详解
  • 面向对象设计的五大原则(SOLID 原则)
  • Jsp学习笔记(详解)
  • 【2025】儿童疫苗接种预约小程序(源码+文档+解答)
  • python 实现collatz sequence考拉兹序列算法
  • 如何使用下拉字段创建WordPress表单(简单方法)
  • 1.熟悉接口测试(Postman工具)