Android-Studio-MVP-template icon indicating copy to clipboard operation
Android-Studio-MVP-template copied to clipboard

MVP template not working in android 3.0

Open mhdtouban opened this issue 8 years ago • 4 comments

Following the instructions, you have on the homepage. When I copied the MVP activities to the android studio directory the Android Studio Application got damaged. However, when I followed the same instruction on android 2.3 everything went well.

mhdtouban avatar May 19 '17 14:05 mhdtouban

Hi there,

Indeed Android Studio 3.0 on macOS changes the way the app is signed and thus you cannot change any file inside the app bundle without breaking the signature.

I have a temporary workaround that consists in un-signing the app:

  • Download this repo: https://github.com/steakknife/unsign
  • Follow the instructions for building the unsign executable (just run make as the doc says).
  • Run the unsign script with Android Studio executable and use the unsign version:
./unsign /Applications/Android\ Studio\ 3.0\ Preview.app/Contents/MacOS/studio
mv /Applications/Android\ Studio\ 3.0\ Preview.app/Contents/MacOS/studio.unsigned /Applications/Android\ Studio\ 3.0\ Preview.app/Contents/MacOS/studio

You can now execute Android Studio 3.0 and it should work !

Note that GateKeeper won't allow you to start AS 3.0 since it's not signed anymore, follow Apple's instructions to run it: https://support.apple.com/kb/PH25088?locale=en_US

benoitletondor avatar May 19 '17 15:05 benoitletondor

Note that the method described in my previous answer seems to kinda break the auto update process.

The window tells that update is impossible but it seems to be working, it needs to be examinated

benoitletondor avatar May 29 '17 12:05 benoitletondor

I've followed your instruction @benoitletondor but, still got same error

==> applicationPackage  [in template "root://activities/MVPActivity/root/src/app_package/classes/Activity.java.ftl" at line 6, column 10]

Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)??

The failing instruction:
==> ${applicationPackage}  [in template "root://activities/MVPActivity/root/src/app_package/classes/Activity.java.ftl" at line 6, column 8]
FreeMarker template error:
The following has evaluated to null or missing:
==> applicationPackage  [in template "root://activities/MVPActivity/root/src/app_package/classes/Activity.java.ftl" at line 6, column 10]

Tip: If the failing expression is known to be legally null/missing, either specify a default value with myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthessis: (myOptionVar.foo)!myDefault, (myOptionVar.foo)??

The failing instruction (FTL stack trace):
----------
==> ${applicationPackage}  [in template "root://activities/MVPActivity/root/src/app_package/classes/Activity.java.ftl" at line 6, column 8]
----------

Java stack trace (for programmers):
----------
freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...]
	at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:98)
	at freemarker.core.EvalUtil.coerceModelToString(EvalUtil.java:382)
	at freemarker.core.Expression.evalAndCoerceToString(Expression.java:115)
	at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
	at freemarker.core.Environment.visit(Environment.java:265)
	at freemarker.core.MixedContent.accept(MixedContent.java:93)
	at freemarker.core.Environment.visit(Environment.java:265)
	at freemarker.core.Environment.process(Environment.java:243)
	at freemarker.template.Template.process(Template.java:277)
	at com.android.tools.idea.templates.FreemarkerUtils.processFreemarkerTemplate(FreemarkerUtils.java:96)```

asrulsibaoel avatar Nov 27 '17 23:11 asrulsibaoel

Hi @asrulsibaoel,

I checked your report and made a little fix, it's released with the 2.2.2 tag. You can pull the last code from the repo and it should work ok now.

Thank you for reporting the issue.

benoitletondor avatar Nov 28 '17 09:11 benoitletondor