Sunday, November 8, 2015
android studio add outside module
Tuesday, October 27, 2015
android studio exists with eclipse adt project in same folder
our old android project is desiged by eclipse with android developer tools(adt),now,we want to used android studio ide to open it.but other co-workers want to used eclipse in same project.
how:
create one build.gradle in eclipse android project:
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.3.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } ///////////////////////////////////////////////////////////////////////////////////////// apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "23.0.1" defaultConfig { applicationId "com.your.application.package" minSdkVersion 10 targetSdkVersion 22 } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] jniLibs.srcDirs = ['libs'] } // instrumentTest.setRoot('tests') } buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-project.txt' } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') }
////////////////////////////////////////////////////////////////////
After:
we only add build.gradle with vcs(git,svn). can ignore:
.gradle\
.idea\
bin\
build\
gen\
gradle\
proguard\
*.iml
gradlew
gradlew.bat
local.properties
Tuesday, October 20, 2015
android studio build.gradle default task list simple draft
bellow is andriod studio default task list in right Gradle projects panel:
assemble
assembleAndroidTest
assembleDebug
assembleRelease
build
buildDependents
buildNeeded
compileDebugAndroidTestSources
compileDebugSources
compileDebugUnitTestSources
compileReleaseSources
compileReleaseUnitTestSources
mockableAndroidJar
bellow is android studio task,if your are so intelligent,your may known how get the easily answer from android studio ide.
By the way,I will simply tell how write build task depends on parameters, if android studio output like:":app:generateDebugSources",your can reference it in app self project by:
task yourtaskname(dependsOn:['generateDebugSources'])
,if in other proejct,your can reference it by:
task yourtaskname(dependsOn:[':app:generateDebugSources'])
bellow is default build output log:
Executing tasks: [clean, :app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:compileDebugSources, :app:compileDebugAndroidTestSources, :benshoujisdk:generateDebugSources, :benshoujisdk:generateDebugAndroidTestSources, :benshoujisdk:compileDebugSources, :benshoujisdk:compileDebugAndroidTestSources, :benshoujisdkdemo:generateDebugSources, :benshoujisdkdemo:generateDebugAndroidTestSources, :benshoujisdkdemo:compileDebugSources, :benshoujisdkdemo:compileDebugAndroidTestSources, :dynamicloadapklib:generateDebugSources, :dynamicloadapklib:generateDebugAndroidTestSources, :dynamicloadapklib:compileDebugSources, :dynamicloadapklib:compileDebugAndroidTestSources, :sdkbase:generateDebugSources, :sdkbase:generateDebugAndroidTestSources, :sdkbase:compileDebugSources, :sdkbase:compileDebugAndroidTestSources, :sdkproxy:generateDebugSources, :sdkproxy:generateDebugAndroidTestSources, :sdkproxy:compileDebugSources, :sdkproxy:compileDebugAndroidTestSources]
Configuration on demand is an incubating feature.
:clean
:app:clean
:benshoujisdk:clean
:benshoujisdkdemo:clean
:dynamicloadapklib:clean
:sdkbase:clean
:sdkproxy:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:generateDebugAndroidTestAssets UP-TO-DATE
:app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:processDebugAndroidTestJavaRes UP-TO-DATE
:app:compileDebugAndroidTestJavaWithJavac
:app:compileDebugAndroidTestNdk UP-TO-DATE
:app:compileDebugAndroidTestSources
:benshoujisdk:preBuild UP-TO-DATE
:benshoujisdk:preDebugBuild UP-TO-DATE
:benshoujisdk:checkDebugManifest
:benshoujisdk:preDebugAndroidTestBuild UP-TO-DATE
:benshoujisdk:preDebugUnitTestBuild UP-TO-DATE
:benshoujisdk:preReleaseBuild UP-TO-DATE
:benshoujisdk:preReleaseUnitTestBuild UP-TO-DATE
:sdkbase:compileLint
:sdkbase:copyReleaseLint UP-TO-DATE
:sdkbase:mergeReleaseProguardFiles UP-TO-DATE
:sdkbase:preBuild UP-TO-DATE
:sdkbase:preReleaseBuild UP-TO-DATE
:sdkbase:checkReleaseManifest
:sdkbase:prepareReleaseDependencies
:sdkbase:compileReleaseAidl
:sdkbase:compileReleaseRenderscript
:sdkbase:generateReleaseBuildConfig
:sdkbase:generateReleaseAssets UP-TO-DATE
:sdkbase:mergeReleaseAssets
:sdkbase:generateReleaseResValues UP-TO-DATE
:sdkbase:generateReleaseResources
:sdkbase:packageReleaseResources
:sdkbase:processReleaseManifest
:sdkbase:processReleaseResources
:sdkbase:generateReleaseSources
:sdkbase:processReleaseJavaRes UP-TO-DATE
:sdkbase:compileReleaseJavaWithJavac
:sdkbase:packageReleaseJar
:sdkbase:compileReleaseNdk UP-TO-DATE
:sdkbase:packageReleaseJniLibs UP-TO-DATE
:sdkbase:packageReleaseLocalJar UP-TO-DATE
:sdkbase:packageReleaseRenderscript UP-TO-DATE
:sdkbase:bundleRelease
:benshoujisdk:prepareSdkAndroidStudioSdkbaseUnspecifiedLibrary
:benshoujisdk:prepareDebugDependencies
:benshoujisdk:compileDebugAidl
:benshoujisdk:compileDebugRenderscript
:benshoujisdk:generateDebugBuildConfig
:benshoujisdk:generateDebugAssets UP-TO-DATE
:benshoujisdk:mergeDebugAssets
:benshoujisdk:generateDebugResValues UP-TO-DATE
:benshoujisdk:generateDebugResources
:benshoujisdk:mergeDebugResources
:benshoujisdk:processDebugManifest
:benshoujisdk:processDebugResources
:benshoujisdk:generateDebugSources
:benshoujisdk:prepareDebugAndroidTestDependencies
:benshoujisdk:compileDebugAndroidTestAidl
:benshoujisdk:compileLint
:benshoujisdk:copyDebugLint UP-TO-DATE
:benshoujisdk:mergeDebugProguardFiles UP-TO-DATE
:benshoujisdk:processDebugJavaRes UP-TO-DATE
:benshoujisdk:compileDebugJavaWithJavac
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
:benshoujisdk:packageDebugJar
:benshoujisdk:compileDebugNdk UP-TO-DATE
:benshoujisdk:packageDebugJniLibs
:benshoujisdk:packageDebugLocalJar
:benshoujisdk:packageDebugRenderscript UP-TO-DATE
:benshoujisdk:packageDebugResources
:benshoujisdk:bundleDebug
:benshoujisdk:compileDebugSources
:benshoujisdk:assembleDebug
:benshoujisdk:processDebugAndroidTestManifest
:benshoujisdk:compileDebugAndroidTestRenderscript
:benshoujisdk:generateDebugAndroidTestBuildConfig
:benshoujisdk:generateDebugAndroidTestAssets UP-TO-DATE
:benshoujisdk:mergeDebugAndroidTestAssets
:benshoujisdk:generateDebugAndroidTestResValues UP-TO-DATE
:benshoujisdk:generateDebugAndroidTestResources
:benshoujisdk:mergeDebugAndroidTestResources
:benshoujisdk:processDebugAndroidTestResources
:benshoujisdk:generateDebugAndroidTestSources
:benshoujisdk:processDebugAndroidTestJavaRes UP-TO-DATE
:benshoujisdk:compileDebugAndroidTestJavaWithJavac
:benshoujisdk:compileDebugAndroidTestNdk UP-TO-DATE
:benshoujisdk:compileDebugAndroidTestSources
:benshoujisdkdemo:preBuild UP-TO-DATE
:benshoujisdkdemo:preDebugBuild UP-TO-DATE
:benshoujisdkdemo:checkDebugManifest
:benshoujisdk:copyReleaseLint UP-TO-DATE
:benshoujisdk:mergeReleaseProguardFiles UP-TO-DATE
:benshoujisdk:compileReleaseNdk UP-TO-DATE
:benshoujisdk:packageReleaseJniLibs
:benshoujisdk:packageReleaseRenderscript UP-TO-DATE
:benshoujisdk:checkReleaseManifest
:benshoujisdk:prepareReleaseDependencies
:benshoujisdk:compileReleaseRenderscript
:benshoujisdk:generateReleaseResValues UP-TO-DATE
:benshoujisdk:generateReleaseResources
:benshoujisdk:packageReleaseResources
:benshoujisdk:compileReleaseAidl
:benshoujisdk:generateReleaseBuildConfig
:benshoujisdk:generateReleaseAssets UP-TO-DATE
:benshoujisdk:mergeReleaseAssets
:benshoujisdk:mergeReleaseResources
:benshoujisdk:processReleaseManifest
:benshoujisdk:processReleaseResources
:benshoujisdk:generateReleaseSources
:benshoujisdk:processReleaseJavaRes UP-TO-DATE
:benshoujisdk:compileReleaseJavaWithJavac
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
:benshoujisdk:proguardRelease
Friday, October 16, 2015
android studio build.gradle quick couse 1 by pkrss
== android studio build.gradle ==
1.define custom variable in module build.gradle:
///////////////////////////////////////////////////////////////////////////////
//
def a = true
def b = "string"
//
///////////////////////////////////////////////////////////////////////////////
2.use if condition variable in module build.gradle:
///////////////////////////////////////////////////////////////////////////////
//
if(a)
apply plugin: 'com.android.library'
else
apply plugin: 'com.android.application'
//
///////////////////////////////////////////////////////////////////////////////
3.define custom global whole module variable in one project build.gradle:
///////////////////////////////////////////////////////////////////////////////
//
1. define it in project root build.gradle:
project.ext.set("buildRelease", true)
2.used it in sub module build.gradle:
if(buildRelease)
apply plugin: 'com.android.library'
else
apply plugin: 'com.android.application'
//
///////////////////////////////////////////////////////////////////////////////
4.define task in build.gradle: (sample with widows path style)
///////////////////////////////////////////////////////////////////////////////
//
def proguardJar(String target){
exec{
workingDir './../../tools/guard'
commandLine 'cmd', '/c', 'proguard5.2.1\\bin\\proguard.bat',"-include", 'profile/' + target + '.txt'
}
}
def makeJar(String target){
exec{
executable "jar" //jar program
args "cvf","../../tools/guard/injars/" + target + ".jar"
args "-C", "../" + target + "/build/intermediates/classes/release"
args "","."
}
proguardJar(target)
}
def releaseDocSource(String ver){
exec{
workingDir './../../tools/bat'
commandLine 'cmd', '/c', 'copyres.bat',ver
}
}
task buildLib(dependsOn:['build'])<< {
makeJar("benshoujisdk")
releaseDocSource("1.1.13")
}
//
///////////////////////////////////////////////////////////////////////////////
5. how to run custom task in android studio
///////////////////////////////////////////////////////////////////////////////
//
it is called 'Gradle projects', in right panel of android studio, then click num 4 button, it likes green ring, and comment 'Execute Gradle Task'. then will open one popup window
line one Gradle project: click right drop button,select one project,
line two Command line: type task name, like above "buildLib"
line three: click ok.
after that,you can see the logs in "Run" or "Gradle Console" panel in the bottom of android studio.
//
///////////////////////////////////////////////////////////////////////////////
6. how to add one exist android studio module in android studio project.
///////////////////////////////////////////////////////////////////////////////
//
copy your exist andriod studio module folder into andriod studio project.
then edit settings.gradle, and add it: include ':your new module folder name'
//
///////////////////////////////////////////////////////////////////////////////
7. what is the shortkey like undo ctrl+z
///////////////////////////////////////////////////////////////////////////////
//
in some editor,it call ctrl+y,but in android studio,default is shirt+ctrl+z
and:
alt+f7: see useage of some class or function
f7: step in
f8: step over
f9: run
esc: close quick search float bar
//
///////////////////////////////////////////////////////////////////////////////
8. add some libs or module or aar depends
///////////////////////////////////////////////////////////////////////////////
//
1.edit your module/build.gradle:
dependencies {
compile(name: 'CyberLink4Android', ext: 'aar') // add depends: CyberLink4Android aar
// compile fileTree(include: ['*.jar'], dir: 'libs') // add depends: all libs/* jar
compile 'com.android.support:support-v4:23.0.1' // add depends: android.support.v4 by online mode
compile project(':mdns') // add depends: mdns module project depends
}
//
///////////////////////////////////////////////////////////////////////////////
9. jni ndk developer quickly tip
///////////////////////////////////////////////////////////////////////////////
//
1.install ndk
edit your ndk and sdk path in local.properties,like this:
ndk.dir=D\:\\sdk\\android-ndk-r10e
sdk.dir=D\:\\sdk\\androidsdk
2.copy files into your module/src/main/jni
3.edit gradle.properties,if not exist,create it
android.useDeprecatedNdk=true
4,edit your module build.gradle, like bellow: (some is not need,modify as your need)
android {
sourceSets.main {
jniLibs.srcDir 'src/main/libs'
jni.srcDirs = []
}
defaultConfig {
ndk {
moduleName "jdns_sd"
ldLibs "log"
abiFilters "armeabi", "x86"
cFlags "-DMDNS_DEBUGMSGS=0 -DTARGET_OS_ANDROID -DUSES_BROADCAST_AND_MULTICAST -DNOT_HAVE_SA_LEN -DUSES_NETLINK" +
" -I${project.buildDir}/../src/main/jni -I${project.buildDir}/../src/main/jni/mDNSShared -I${project.buildDir}/../src/main/jni/mDNSCore -I${project.buildDir}/../src/main/jni/mDNSPosix"
}
}
buildTypes {
release {
debuggable false
jniDebuggable false
minifyEnabled false
}
debug {
debuggable true
jniDebuggable true
ndk {
cFlags "-g -D_DEBUG -UNDEBUG"
}
}
}
}
task genJavaH(dependsOn: ['build']) << {
exec {
workingDir 'src/main'
commandLine 'javah', '-force', '../../build/intermediates/classes/debug', '-o', 'jni/DNSSD.java.h','com.apple.dnssd.AppleDNSSD com.apple.dnssd.AppleBrowser com.apple.dnssd.AppleResolver com.apple.dnssd.AppleRegistration com.apple.dnssd.AppleQuery com.apple.dnssd.AppleDomainEnum com.apple.dnssd.AppleService com.apple.dnssd.AppleDNSRecord com.apple.dnssd.DNSSDEmbedded'
}
}
//
///////////////////////////////////////////////////////////////////////////////
Monday, October 5, 2015
Today, my Google Play Publisher account has been terminated,and i reply
Part I English
In the morning,i received one email from google.Here is content:
// start ----------------------------------------------------------------------
This is a notification that your Google Play Publisher account has been terminated.
REASON FOR TERMINATION: Multiple violations of the Content Policy and Developer Distribution Agreement as outlined in previous emails sent to the registered email address of your Publisher account.
Please note that Google Play Publisher terminations are associated with developers, and may span multiple account registrations and related Google services. If you feel we have made an error, you can visit the Google Play Help Center article for additional information regarding this termination.
Please do not attempt to register a new developer account. We will not be restoring your account at this time.
The Google Play Team
// end ----------------------------------------------------------------------
And i replay it with chinese. (english is translated by google and manual)
// start ----------------------------------------------------------------------
This three years. . .
Perhaps because i submitted one software called "Chinese people learning English," English literature or translation application relates to a unit still copyrighted (mostly English literature has indeed been confirmation of protection, and the Chinese translation is extracted from the network) be warned, the application has been shut down already unrecoverable.
There is also a what application, because not landing publishing platform, I really can not remember what a small application, because of what has been shut down.
And because of this, three days before the submission of the night 10.4. "Beauty image" image browsing tool. Because in the content rating review their own in case of multi porn VGH option, or in my own server using flickr, bing, google image search results, or you occasionally review pictures what included some badly result (which I can not yet control the search results). This application shows the default search label, this is Baidu public image Chinese label, the other language labels results are obtained from machine translation.
I beg you to restore the account. "Global voice news king", "voice browser", "古文名著", "中医", Above application are also affected.
In addition, I will modify or delete "Beauty image" image browsing tools, control internet search results, and increase local album browsing, picture browsing effects. Above are the original idea of the application design.
Thank you. Another If you can, please give me detail reason of delete action, such as (machine grading review content, manual review image results).
Also, if for some reason by the impact of certain applications and disrupting the entire developer account, which is not to let individual developers continue to submit creative design acts declared prohibited to google play or world humanity. Consider just some of the applications should be closed so that developers much blow. Developers are not legal experts, your point is that the law's top law professors not necessarily be able to understand, and your notice provisions is so rough, so machinery. Whenever I receive mail in those terms, whether they come from google, microsoft, amazon, paypal ...., mail recipients, including me, how many people will really send on time and careful grinding. . .
Developers pkrss
2015.10.6 10:38 am
// end ----------------------------------------------------------------------
Part II 中文
// start ----------------------------------------------------------------------
Saturday, February 28, 2015
中国电信HUA WEI华为Y300C定制机 完美破解G卡上网操作记录
2015-02-27
我操作了,没有用。
华为P6电信G网开启方法
注意事项:华为P6开启G网操作必须获得Root权限。
然后:
第一步:安装RE管理器和SQLite编辑器;(RE浏览器会在Root后自动安装,SQLite编辑器需自行下载
第二步:通过RE管理器找到/cust/telecom/cn/prop/local.prop文件,长按之后选择“以文本编辑器打开”;
第三步:把ro.config.hide_gsm_apn=true改为ro.config.hide_gsm_apn=false(打开GSM的APN设置),然后再增加一行persist.service.gsmdataservice=true(负责开启GSM上网)
第四步:保存退出,此刻会生成一个.bak文件,这个可以删掉。同时把修改后的local.prop文件拷贝一份到\data\cust\prop目录下;
第五步:重启P6,现在手机可以自由切换C网和G网了
补充说明:
1、\cust\telecom\cn\目录下的文件和\data\cust\目录下的文件是一样的
2、\cust\telecom\cn\xml\apns-conf.xml文件下是网络设置文件,包括电信、移动、联通和华为设置参数,可自行进行修改
3、\cust\telecom\cn\delapp目录下是电信定制软件,可自行进行删除,恢复出厂值后被删软件不会再出现。
我修改:
(这步我也做了)
ro.card2.custom_operator=460-455
persist.service.gsmdataservice=true
3、通过RE管理器找到/cust/telecom/cn/prop/local.prop文件,长按之后选择“以文本编辑器打开”,把ro.config.hide_gsm_apn=true改为ro.config.hide_gsm_apn=false(打开GSM的APN设置),然后再增加一行persist.service.gsmdataservice=true(负责开启GSM上网),保存退出,会生成一个.bak文件,这个可以删掉。同时把修改后的local.prop文件拷贝一份到\data\cust\prop目录下。
4、通过RE管理对/data/data/com.android.providers.settings/databases/settings.db文件进行修改,必须用sqlite打开,否则不能修改。选择system, 然后在顶上选择+后,在name输入gsm_enable_ct,value里输入1,保存退出。这个是打开默认数据的选择(切换C网或G网,在国际漫游设置-网络选择和设置的CDMA上的)。注意,手机恢复出厂值后这个设置会消失,请重新添加。
5、手机重启,然后你就可以自由切换C网和G网了。
通过电信与GSM的刷机包对方,可能只要修改xml\hw_defaults.xml,其它的我做草稿。
建议此步覆盖 \cust\chinatelecom\cn
xml\hw_defaults.xml
E:<bool unable_edit_mmsc="false"/>
A:<!--DTS201303191339 gfpig 20130319 begin-->
<integer gsm_used_for_cdma="1"/>
<integer gsm_enable_ct="1"/>
<bool settings.secure.install_non_market_apps="true"/>
<integer settings.system.time_12_24="24" />
<string settings.secure.location_providers_allowed=""/>
<integer settings.system.accelerometer_rotation="0"/>
<!--DTS201303191339 gfpig 20130319 end-->
E:<!--string ct_custom_operator="46003-460003-45502-455002"/-->
另两个记录草稿:
xml\hw_launcher_default_config.xml xml\mms_config.xml
删除 (这一步好像无效) \data\data\com.android.settings\shared_prefs\com.android.settings_preferences.xml
重启手机启效。