sat atebed bad 发音ant 哪个发音不同

(标精文章)自然拼音法发音规律汇总
我的图书馆
(标精文章)自然拼音法发音规律汇总
馆友“长沙7喜”:&&&& &&&&您好!您的馆藏文章“”深受广大馆友的喜爱,于日进入“阅览室”频道的“教育/学习”下“小学课堂”类别的精华区。360doc代表全体馆友感谢您的辛勤劳动和慷慨分享!────360doc个人图书馆亲子教育小编语:当小学生开始汉语拼音学习时,也正是开展英语自然拼读法的时候。采编好的资料供有心的老师们和家长们收藏并运用到孩子们的教学上,让孩子们学起英语来如虎添翼。本文资料转自网络,因为转发较多,已经分不清谁是原创作者了,原创作者知情后请跟编者 @有个乖乖 联系,一定署上您的大名和推荐您的博客链接地址。如您著有小学阶段学习捷便方法,愿意跟大家分享的话,一定要跟 @有个乖乖 联系喔~!在此,@有个乖乖 代大家谢谢您总结这么好的资料! & & &(注:如果你的电脑上没有安装YB字体的话,音标看着是不正确的。建议你安装一个音标字体再看音标)。第一部分:26个字母的发音:通过学唱一首歌曲《The &alphabet song》,轻松掌握26个字母的发音,26个字母的发音要点如下:1、五个元音字母Aa、Ee、Ii、Oo、Uu有两种发音:A says &[ei] & [?] ;E says &[i:] & [е];I says &[ai] & [i];O says &[?u] && [?]; &U &says &[ju:] & [Λ] &总结归纳:五个元音字母有两种发音,第一种是长音:即字母本身的读音;第二种是短音,通过下列口诀记忆:五个元音字母发短音的记忆口诀:Aa for &apple &[?] &[?] & [?];Ee for &egg & [е] & [е] &[е];Ii for & &is & [i] & [i] & &[i];Oo for &orange &[?] & &[?] & & [?];Uu &for & &up & &[Λ] & [Λ] &[Λ].2、21个辅音字母的读音中有大部分跟汉语拼音的读音相似,通过歌曲学唱记忆。21个辅音字母的音标如下: B---[b] & &C---[k] & D----[d] &F---[f] & G---[g] & &H---[h] J----[d?] & &K---[k] & &L----[l] & M---[m ] & N--[n] &P---[p]Q---[kw] &R---[r] & &S---[s] & T---[t] &V---[v] & W---[W]X---[ks] &Y---[j] & &Z---[z] &3、自然拼音法的拼读方法:和汉语拼音的拼读方法类似,用元音前面的辅音和元音相拼而形成的读音,就是一个音节的读音,再把其他的音加进去。比如:name的音标是[neim],就把[n]和[ei]相拼得到的读音,再加上后面的辅音[m],就得到了这个单词的读音。4、五个元音字母的发音规律: & 以“一个元音字母+一个辅音字母+e”结尾的词叫做开音节单词,简称为:以“元辅e”结尾的单词。 & 以“一个元音字母+一个或两个辅音字母”结尾的单词叫做闭音节单词,简称为“以元辅或元辅辅”结尾的单词。 & 五个元音字母在开音节单词中读第一种读音:即字母本身的读音; & 五个元音字母在闭音节的单词中读第二种读音:即口诀里面的读音。1)、A 在开音节单词中读字母本身的音:[ei],例词如下:cake &bake & make & take &lake & wake & snake &ate & date & gate & hate & &late & plate face &race &place fade &made & grade &cafe & safe & name same & game & tape plane 2)E在开音节单词中读字母本身的音:[i:], 例词如下:theme &these3)、I在开音节单词中读字母本身的音:[ai],例词如下:bike like & Nike & nice rice &ice & mice &price &bite kite life &wife & five dive & line &fine &mine &nine &wine pine &hide &ride side & wide &mile pile &smile &time pipe 4)O在开音节单词中读字母本身的音:[?u],例词如下: nose & home &bone &rose &note &hole pole &rope &vote rode &zone &slope smoke & globe 5) &U在开音节单词中读字母本身的音:[ju:],例词如下: & & use &cute &mute & excuse 6) & & & & & &A在闭音节单词中读短音:[?],例词如下: & bag cat & cap & dad &bad & fat &flat &has & gas & hat &map &mad &lamp &rat & sat & sad &glad & land & and &man &hand & ant can & flag & back7) & & & & & & & E在闭音节单词中读短音:[е],例词如下:bed &pen &get &leg &let & net &tell neck &desk &hen egg &wet &met & pet &red &next beg & &bend & send &help &rest &well sell &left & yes8) & & & & & & & I在闭音节单词中读短音:[i],例词如下:it &is & &in & &if &his & sit & hill film &did & swim &fish & milk &pig &big &ill9) & & & & & & & O在开音节单词中读短音:[?],例词如下: dog &box &fox hot &not &boss fond &lot &pot lost &got &job soft &frog &cock clock &cross &fog from &god & golf &on &off &pond10) & & & & & U在闭音节单词中读短音:[Λ] ,例词如下: bus &but &cut & bug &hut & mug &duck &cup &run & nut mum & gun &fun sun & hug &rub luck &suck & must jump & plus &dust &just
总结归纳:五个元音字母在开音节单词中读长音,即字母本身的读音;五个元音字母在闭音节单词中读短音,即口诀里面的读音。简称为:“开长闭短”。
第二部分:辅音字母组合的读音: &在英语中,有一些辅音字母有时候两两组合时,发一些固定的音,这个就叫做辅音字母组合音。熟记下列辅音字母组合的读音: & &1、th mouth &[θ] &thank & &think & three tooth & thin & & &thick & &2、th &clothes &[e] & &this &that & these & those with &then & &than &the &
& &3、ch & &Hh & & &[t∫] & chick &lunch & much & French
& & & &4、tch & Hh & & &[t∫] & &catch &match & &fetch & & & & &5、sh & fish & & [∫] & &fish &ship & shot & shake &shut shall & &fresh
& & 6、wh &what & &[W] & &what &when &which & white &while
& & 7、wh & who & &[h] & &who & whom &whole & whose
& & 8、ph & Ff & & &[f] & &phone & photo &phrase &graph & & &9、ck &Kk & & &[k] & duck & clock & chick &pick &truck &quick &quack & rock &sock
10、qu______________ [kw] & &quick quack &
11、ng & &song & & &[?] & &song sing & &long & &hang &thing & bring &12、tr &tree & &[tr] & & tree &truck & trip track & trust & 13、dr &drink & &[dr] &drink & dress &drop &drive &drum & drug 14、ts &what’s &[ts] &cats & hats &gets & nuts &cuts 15、ds & hands & & [dz] beds &birds &hands &sends &lands
16、ful &__________[ful] &useful &beautiful & helpful
17、 ing -----------[i ?] & sing swing &playing &going swimming 18、tion ______________[∫? n] &nation &fiction dictionary 下面几个辅音字母组合在一起时只发其中一个字母的音:19、kn &_______[n] & knife &knock &knit & knight 20、wr &_______[r] & write &wrong21、mb &________[m ] &climb bomb & numb & lamb &22、ge &orange & [d?] &orange bridge &fridge 当[s]碰到清辅音时要浊化:23、st__________[sd] & &star & stand strong &story & stop stone24、sp________[sb] & &sport & spoon &speak & space & spell25、sk___________[sg] & skirt &school & skate ski &26、str__________[sdr] &street &strong27、spr__________[sbr] & spring28、scr___________[sgr] &screen 第三部分:元音字母组合的发音:英语中,有一些元音字母组合或者元音字母与辅音字母的固定字母组合常常发一个固定读音,熟记下列字母组合的发音:1、ou ow &out & [au] &mouth &mouse &house & cloud
& & & & & & & & & & & & cow & now &town & brown & 2、oi & oy & boy & [?i] &boy & toy &coin &cil & boil noise
& & & & & & & & & & & & &point & voice
3、au &aw &augh ough &all &[?:] &Agust Paul &autumn
& & & & & & & & & & & & & & & & &saw & crawl
& & & & & & & & & & & & & & & & &taught &caught & naughty
& & & & & & & & & & & & & & & & &bought & thought
4、al & all & all & & [?:] &talk & walk &bald & salt & chalk
& & & & & & & & & & & & & & tall & wall & fall & ball & small 5、oo _________________[u:] &too &zoo & pool &fool & moon &noon & & & & & & & & & & & & & & soon &cool &room & food &roof tool & & & & & & & & & & & & & & goose &school spoon &boot & tooth
& & & & & & & & & & & & & loose & shoot &troop &choose smooth 6、oo_________________ [u] good & foot & stood wood & book &cook & look & took & hookoo字母组合发短音记忆口诀:好脚站在木头上,碰见老K发短音。7、下列三个字母组合都发作元音字母Aa的读音:[ei]。ai--------- [ei] &rain gain & pain &tail wait &bait &trainaim &snail & maid & fail lain &e-mail ay------------[ei] &day say &way &lay gay &pay &play may & & & & & & & & & &today & stay & eigh----------[ei] & eight &neighbor
8、下列四个字母组合都发作元音字母Ee的读音:[i:] ee------------[i:] & bee &see & meet & tree three &week &feetsweet street & green & queen &betwescreen &sleep & asleep & deep &keepjeep &sheep & deed & feed &need &greetspeed &succeed & ea--------------[i:] &tea &sea & meat & bean &peach & each & lean clean &maen & reach &beach & easy &cheap &lead & leaf & team &read & leave &deal & meal & real & dream &teach & ideal
& & & & & & & & & & &steal & eat & beat & teacher &heat &seat
& & & & & & & & & & &weak & &east &please & speak & least jeans & &ey------------[i:] & &key money &donkey &honey monkey
& &ie-------------[i:] & thief &field piece &chief
&9、下列四个字母组合都发作字母Ii的读音:[ai] ie--------------[ai] & die tie &lie &pie 备注:ie在词中读[i:];ie在词尾读[ai]。 igh-------------[ai] &high might &light &night knight
ild-------------[ai] & wild mild & ind-------------[ai] & kind &find &behind &blind 10、下列四个字母组合都发作Oo的读音:[?u]
oa --------------[?u] &coat soap &boat &goat road &coal &load
ow---------------[?u] &know &row & low & grow &flow & yellow &window snow & show & borrow old--------------[?u] &old gold &cold &sold
ost--------------[?u] &post host &most & ghost 11、下列两个字母组合都发作Uu的读音:[j u:] ui-----------[j u:] & suit ew-----------[j u:] & new &chew & stew & few &第四部分:R音节的发音: & 什么叫R音节?R音节就是五个元音字母a、e、i、o、u和字母r组合在一起时的读音。 &ar------------[ɑ:] & &car &bar &far & barn &star &bark & mark &park sars &large & March
&er------------[ ?] & father & mother &sister brother &teacher & &ir/ur---------[?:] & & bird &girl & shirt & skirt &first & thirteen & & & & & & & & & & & & &turn & &burn &curt &nurse &hurt purse
&or------------[?:] & &for &horse sport &nor &north force &oral
& & & & & & & & & & & & &morning &glory born &corn &order
ore------------[?:] & &more &bore &score before第五部分:特殊规律的发音:1、 & & & & & &ea字母组合读作:[e],熟记下列单词:head bread &sweater &weather &pleasant health &already
&2、 &u、ue、ui在j、r、l、后面时读作[u:],熟记下列单词: & & ruler &true &pollution &juice &fruit blue &glue clue 2、 & & & & & &字母c的两种读音:C在胖元音a、o、u前面读作[k]:cat &cap &cost &cup &cut C在瘦元音e、i、y前面读作[s]:city &cell nice & rice
3、 & & & & & &字母g的两种读音:g在胖元音a、o、u前面读作[g]: &gas &got goat &gum g在瘦元音e、i、y前面读作[d?]: gym orange cage &age &page digital bridge &judge &charge change edge &fridge &rige geography 4、 & & & & & &字母s的两种读音:S大部分时候读作[s]: & & &sand &sister &sunS夹在两个元音之间时读作[z]: nose & use excuse &please 5、 & & & & & &字母y的三种读音:y作辅音字母时,一般位于词首,读作[j]: yes &yo-yo yellowy作元音字母时,有两种读音:在长单词末尾读作[i]: daddy &mummmy &sunny & bunny &funny &baby & story &glory
dictionary &strawberry在短单词末尾读作[ai]: & why &shy & fly & cry try & &dry &sky spy
第六部分:五个元音字母的弱读: & & & &前面讲的那些发音规律一般是指重读时候的发音规律,五个元音字母有的时候会弱读为[?]或[i],而且大部分时候是弱读为[?],少部分时候弱读为[i]。1)a在单词中弱读为[?]:sofa oral &panda &about &around & address & afford &alarm & America & another banana & January & salad &breakfast & dictionary & &festival 2)e在单词中弱读为[?]: & &broken &chicken & comedy &listen & parent &strawberry &student
3)i在单词中弱读为[?]: & &April & cousin & 4)o在单词中弱读为[?]: & broccoli &carrot & collect & favorite &history & o’clock & of bottom & &chocolate 5)u在单词中弱读为[?]: & August difficult & success &focus
6)五个元音字母在少数时候弱读为[i]:chocolate chicken & &favorite & 第七部分:单词的拼读方法和步骤: & &第一步:找元音,找出单词中的元音字母或元音字母组合。 & &第二步:找元音前面的辅音或辅音字母组合。 & &第三步:两音相拼。 & &第四步:把其他的音加进去。 & &第五步:对于双音节单词和多音节单词,注意重读和弱读。 例如:bag & pen &his &not &cup
& &father &mother & sister &brother &第八部分:双音节词和多音节词的音节划分方法: & &一般的原则是:元音和元音前面的辅音构成一个音节。如果两个元音之间夹有一个辅音或一个辅音字母组合,则该辅音归后;如果两个元音之间夹有两个辅音,则利用就近原则,各属其一。例如:辅音归后:river &away about &alarm & &along become &bedroom & & & & & & &before &begin &behind &beside between &birthday &body & & & & & & &busy &butter cartoon & chocolate &cinema clever &corner cover & December farmer &festival &finish
& & &在两个音节中,如果有两个一样的辅音字母时,只读一个辅音。例如:bottom & cotton correct & crossing &funny granny &hobby hurry & & Lesson & letter &little & matter & &middle & merry message mirror & &office &rabbit &really & & sunny & &supper &summer
& & tennis & &terrible & winner worry & &
例如:辅音各属其一,即前面的那个辅音属于前面的音节,后面的那个辅音属于后面的那个音节。 basket bathroom & biscuit &blackboard breakfast broadcast winterfootball &husband & hospita history &London Monday & &monkey & number outside & textbook & & & & & & &painting &panda & &picnic & &public & Sydney &Thursday & & & & & & &welcome &western & window & windy & yesterday
第九部分:认识48个音标: & & & & & & 通过上面的学习,实际上相当于已经很轻松地学完了48个音标,而且不需要通过音标也能轻松地读出大部分单词,做到“见词能读,听音能写”。为了配合目前中小学教材里面需要掌握音标的要求,在这里再把48个音标总结出来,快速认读。
& & 48个英语音标表 &(20个元音+28个辅音) 单元音(12个)短元音[i] & [?] &[?] & [u] &[Λ] & & [?] &[e]长元音[i:] &[?:] &[?:] &[u:] &[ɑ:] 双元音(8个)[ai] [ei] [?i] & &[au] [?u] & [i?] [ ε?] [u?]
清浊成对的辅音(10对)清辅音
[р][t] &[k] [f] & [?] [s] & [tr] [ts] & [∫] [t∫]
浊辅音 [b] [d] &[g] [v] & &[e] [z] [dr] [dz] & [?] [d?] 其他辅音(8个) [h] &[m ] &[n] &[?] & [l] &[r] [w ] &[j] 第十部分:利用短小精悍的英文故事、儿歌以及口诀熟练记忆上面的发音规律,达到“见词能读、听音能写”,轻松突破英语学习第一关---单词关。
馆藏&52891
TA的最新馆藏Ant、Gradle、Python三种打包方式的介绍
博客出自:http:
blog csdn net liuxian13183,转载注明出处! All Rights Reserved !今天谈一下Androdi三种打包方式,Ant、Gradle、Python。当然最开始打包用Ant 很方便,后来转Studio开发
今天谈一下Androdi三种打包方式,Ant、Gradle、。
当然最开始打包用Ant 很方便,后来转Studio开发,自带很多Gradle插件就用了它,然后随着打包数量越多,打包时间成了需要考虑的事,前两者平均打一个包要花费2-3分钟,打30个就要差不多2个小时;而前两者打包的思路主要是,替换Manifest.xml的meta-data下的value值,然后重新编译 注:不管Ant还是Gradle,下面这句都要加入AndroidManifest.xml
而Python打包非常快,几百个包5分钟以内搞定,而它的思路仅是打完一个可发布包后,往apk的META-INF下写入一个含渠道名的文件,由应用去解析这个渠道名即可,不再使用传统的meta-data去标识value值。
编译一般有以下几个步骤:
1.用aapt命令生成R.java文件
2.用aidl命令生成相应java文件
3.用javac命令编译java源文件生成class文件
4.用dx.bat将class文件转换成classes.dex文件
5.用aapt命令生成资源包文件resources.ap_
6.用apkbuilder.bat打包资源和classes.dex文件,生成unsigned.apk
7.用jarsinger命令对apk认证,生成signed.apk
-------------------------------------------------------------我是分割线----------------------------------------------------------------------------
一、简单讲一下Ant打包的流程
1、安装ant,并配置好环境变量,在ant-&lib目录下放入一个ant-contrib-1.0b3.jar
2、在主项目和依赖项目目录下放置build.xml和local.properties(依赖文件只用放sdk_dir就行)
3、在主项目目录下放置custom_rules.xml即可
4、在命令行下,进入要打包的主项目目录下,输入ant deploy即可(如果二次打包要先输入ant clean)
build.xml文件如下
主要作用:声明主项目和依赖项目,sdk的位置、用到的文件如local.properties等
local.properties
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Tue Feb 16 16:07:45 CST 2016
sdk.dir=AndroidSdk的位置,例如:D:\\Android_Software\\adt-bundle-windows-x86_64-\\sdk
sdk.platformtools=YourSdkPm
sdk.tools=YourSdkTools
apk.dir=打出包放的位置-打包前要确定此路径存在,且无中文
app_version=版本号
app_name=版本名称
market_channels=渠道号-以逗号隔开
key.store=密钥存储路径-注意双斜杠\\
key.store.password=密码
key.alias=别名
key.alias.password=别名密码
最重要的custom_rules.xml来了
此文件配置获得打包命令,打包渠道,以及修改文件名,最后打包的过程《完》
-------------------------------------------------------------我是分割线----------------------------------------------------------------------------
二、再讲一下Gradle打包的流程
1、配置好build.gradle,如下
2、studio命令行:
gradlew assembleDebug --打非正式包
gradlew assembleRelease --打正式包
gradlew assembleWandoujiaRelease -打特定渠道
signingConfigs {
keyAlias 'your_alias_key'
keyPassword 'your_key_pwd
storePassword 'your_store_pwd'
storeFile file('your_store_key')
keyAlias 'your_alias_key'
storeFile file('your_store_key')
if (System.console() != null) {
keyPassword System.console().readLine("\nKey password: ")
storePassword System.console().readLine("\nKeystore password: ")
buildTypes {
//多余的参数
minifyEnabled false
zipAlignEnabled false
shrinkResources false
signingConfig signingConfigs.debug
// 显示Log
buildConfigField "boolean", "LOG_DEBUG", "true"
minifyEnabled true//缩小
zipAlignEnabled true
shrinkResources true//删除无用资源
signingConfig signingConfigs.release
// 显示Log
buildConfigField "boolean", "LOG_DEBUG", "false"
applicationVariants.all { variant -&
variant.outputs.each { output -&
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
// 输出apk名称为apkName_v1.0_wandoujia.apk
def fileName = "apkName${defaultConfig.versionName}_${variant.productFlavors[0].name}.apk"
output.outputFile = new File(outputFile.parent, fileName)
proguardFile 'your_cfg'--例:E:/SorkSpace/branches/studio/proguard.cfg
productFlavors {
tencent {}
productFlavors.all {
flavor -& flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
compileSdkVersion 19
buildToolsVersion '22.0.1'
sourceSets {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src//... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
defaultConfig {
applicationId 'com.chemayi.manager'
versionCode 20
versionName '3.0'
minSdkVersion 10
targetSdkVersion 19
// dex突破65535的限制
multiDexEnabled true
// AndroidManifest.xml 里面UMENG_CHANNEL的value为 ${UMENG_CHANNEL_VALUE}
// manifestPlaceholders = [UMENG_CHANNEL_VALUE: "channel_name"]
dexOptions {
incremental true
javaMaxHeapSize "4g"
packagingOptions {
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
lintOptions {
abortOnError false
配置比Ant简单多了,当然在命令行也可以打包,只不过将gradle换成gradlew即可
-------------------------------------------------------------我是分割线----------------------------------------------------------------------------
三、Python打包
1、安装python软件
2、在项目中放入ChannelUtil.java类,用来获得渠道号
3、打好一个包放在与MultiChannelBuildTool.py同级目录
4、在.py同级目录info下的channel.txt添加渠道号
5、点击MultiChannelBuildTool.py即可
文件目录:
ChannelUtil.java
package com.blog.
import java.io.IOE
import java.util.E
import java.util.zip.ZipE
import java.util.zip.ZipF
import android.content.C
import android.content.SharedP
import android.content.SharedPreferences.E
import android.content.pm.ApplicationI
import android.content.pm.PackageManager.NameNotFoundE
import android.preference.PreferenceM
import android.text.TextU
public class ChannelUtil {
private static final String CHANNEL_KEY = "yourchannel";
private static final String CHANNEL_VERSION_KEY = "yourchannel_version";
private static String mC
* 返回市场。
如果获取失败返回""
* @param context
public static String getChannel(Context context){
return getChannel(context, "");
* 返回市场。
如果获取失败返回defaultChannel
* @param context
* @param defaultChannel
public static String getChannel(Context context, String defaultChannel) {
//内存中获取
if(!TextUtils.isEmpty(mChannel)){
//sp中获取
mChannel = getChannelBySharedPreferences(context);
if(!TextUtils.isEmpty(mChannel)){
//从apk中获取
mChannel = getChannelFromApk(context, CHANNEL_KEY);
if(!TextUtils.isEmpty(mChannel)){
//保存sp中备用
saveChannelBySharedPreferences(context, mChannel);
//全部获取失败
return defaultC
* 从apk中获取版本信息
* @param context
* @param channelKey
private static String getChannelFromApk(Context context, String channelKey) {
//从apk包中获取
ApplicationInfo appinfo = context.getApplicationInfo();
String sourceDir = appinfo.sourceD
//默认放在meta-inf/里, 所以需要再拼接一下
String key = "META-INF/" + channelK
String ret = "";
ZipFile zipfile =
zipfile = new ZipFile(sourceDir);
Enumeration entries = zipfile.entries();
while (entries.hasMoreElements()) {
ZipEntry entry = ((ZipEntry) entries.nextElement());
String entryName = entry.getName();
if (entryName.startsWith(key)) {
ret = entryN
} catch (IOException e) {
e.printStackTrace();
} finally {
if (zipfile != null) {
zipfile.close();
} catch (IOException e) {
e.printStackTrace();
String[] split = ret.split("_");
String channel = "";
if (split != null && split.length &= 2) {
channel = ret.substring(split[0].length() + 1);
* 本地保存channel & 对应版本号
* @param context
* @param channel
private static void saveChannelBySharedPreferences(Context context, String channel){
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
Editor editor = sp.edit();
editor.putString(CHANNEL_KEY, channel);
editor.putInt(CHANNEL_VERSION_KEY, getVersionCode(context));
* 从sp中获取channel
* @param context
* @return 为空表示获取异常、sp中的值已经失效、sp中没有此值
private static String getChannelBySharedPreferences(Context context){
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context);
int currentVersionCode = getVersionCode(context);
if(currentVersionCode == -1){
//获取错误
return "";
int versionCodeSaved = sp.getInt(CHANNEL_VERSION_KEY, -1);
if(versionCodeSaved == -1){
//本地没有存储的channel对应的版本号
//第一次使用
或者 原先存储版本号异常
return "";
if(currentVersionCode != versionCodeSaved){
return "";
return sp.getString(CHANNEL_KEY, "");
* 从包信息中获取版本号
* @param context
private static int getVersionCode(Context context){
return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionC
}catch(NameNotFoundException e) {
e.printStackTrace();
return -1;
MultiChannelBuildTool.py
#!/usr/bin/python
# coding=utf-8
import zipfile
import shutil
# 空文件 便于写入此空文件到apk包中作为channel文件
src_empty_file = 'info/yourchannel_.txt'
# 创建一个空文件(不存在则创建)
f = open(src_empty_file, 'w')
# 获取当前目录中所有的apk源包
src_apks = []
# python3 : os.listdir()即可,这里使用兼容Python2的os.listdir('.')
for file in os.listdir('.'):
if os.path.isfile(file):
extension = os.path.splitext(file)[1][1:]
if extension in 'apk':
src_apks.append(file)
# 获取渠道列表
channel_file = 'info/channel.txt'
f = open(channel_file)
lines = f.readlines()
for src_apk in src_apks:
# file name (with extension)
src_apk_file_name = os.path.basename(src_apk)
# 分割文件名与后缀
temp_list = os.path.splitext(src_apk_file_name)
# name without extension
src_apk_name = temp_list[0]
# 后缀名,包含.
例如: ".apk "
src_apk_extension = temp_list[1]
# 创建生成目录,与文件名相关
output_dir = 'output_' + src_apk_name + '/'
# 目录不存在则创建
if not os.path.exists(output_dir):
os.mkdir(output_dir)
# 遍历渠道号并创建对应渠道号的apk文件
for line in lines:
# 获取当前渠道号,因为从渠道文件中获得带有\n,所有strip一下
target_channel = line.strip()
# 拼接对应渠道号的apk
target_apk = output_dir + src_apk_name + "_" + target_channel + src_apk_extension
# 拷贝建立新apk
shutil.copy(src_apk,
target_apk)
# zip获取新建立的apk文件
zipped = zipfile.ZipFile(target_apk, 'a', zipfile.ZIP_DEFLATED)
# 初始化渠道信息
empty_channel_file = "META-INF/yourchannel_{channel}".format(channel = target_channel)
# 写入渠道信息
zipped.write(src_empty_file, empty_channel_file)
# 关闭zip流
zipped.close()
channel.txt

我要回帖

更多关于 英语48个音标发音 的文章

 

随机推荐