framework

导航

android Studio常见问题

1、出现如下报错:
No cached version of org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.50 available for offline mode.
修改方法:如下图不要被选中就可以了

 

 

2、gradle版本与tool是一一对应的

#Tue Feb 25 10:13:48 CET 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-all.zip

buildscript {
repositories {
google()
jcenter()

}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

3、解决studio卡顿问题:

在这里粘贴一下文本:
-Xms2048m
-Xmx2048m
-XX:MaxPermSize=2048m
-XX:ReservedCodeCacheSize=1024m

 

4、android studio签名

1签名流程、
android studio 先buildapk
public2@80-24:~/work/WtkAwsIotApp_1/signature$ ./run.sh
adb install -r Y:\WtkAwsIotApp_1\signature\OdmAwsIot.apk
2、android studio签名
https://blog.csdn.net/ngyzqf/article/details/76222074

生成签名的app方法:
linux下面执行:
./keytool-importkeypair -k ./platform.keystore -p android -pk8 platform.pk8 -cert platform.x509.pem -alias platform
如果缺少keytool,需要配置环境变量
配置环境变量
vi /etc/profile
i插入
添加以下三句export到文件最后 注意JAVA_HOME的目录为你解压jdk的目录版本为你下载的jdk版本
export JAVA_HOME=/java/jdk1.7.0_79
export CLASSPATH=.:%JAVA_HOME%/lib/dt.jar:%JAVA_HOME%/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin

如下配置到android studio
signingConfigs {
    releaseConfig {
        keyAlias 'platform'
        keyPassword 'android'
        storeFile file('/home/gyniu/tools/keystore/platform.keystore')
        storePassword 'android'
    }
}
adb install Y:\WtkAwsIotApp_1\android\OdmAwsIot\app\release\app-release.apk

5、如何导入framework jar

如何导入framework jar
1、Y:\WTK8768_P0_MP1_AP_1\alps\out\target\common\obj\JAVA_LIBRARIES\framework_intermediates copy classes.jar到工程libs下面
2、file---structure 添加framework.jar
3、工程的build.gradle 添加代码

allprojects {
repositories {
google()
jcenter()

}
//add this
tasks.withType(JavaCompile) {
options.compilerArgs.add('-Xbootclasspath/p:app\\libs\\framework.jar')
}
}

4、app的build.gradle 添加代码

dependencies {
//添加如下
//implementation fileTree(dir: 'libs', include: ['*.jar'])
compileOnly files('libs/framework.jar')

implementation 'com.android.support:appcompat-v7:28.0.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 files('libs\\framework.jar') //这个不能添加 否则会引起编译异常
implementation 'com.android.support:multidex:1.0.0'
}

添加如下
preBuild {
doLast {
def imlFile = file(project.name + ".iml")
println 'Change ' + project.name + '.iml order'
try {
def parsedXml = (new XmlParser()).parse(imlFile)
def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' }
parsedXml.component[1].remove(jdkNode)
def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform"
new Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK'])
groovy.xml.XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile))
} catch (FileNotFoundException e) {
// nop, iml not found
}
}
}

posted on 2021-03-04 11:29  framework开发  阅读(337)  评论(0编辑  收藏  举报